WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3  (Read 534 times)

Offline littlebat

  • Newbie
  • *
  • Posts: 25
/usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« on: March 09, 2012, 10:03:59 PM »
I have found this bug exist in Tinycore V3.7.1 and the current Tinycore V4.3.

Code: [Select]
if [ -e "/proc/$(</var/run/rebuildfstab.pid)" ]; then
  touch /var/run/rebuildfstab.rescan 2>/dev/null
  exit
 fi

I think the purpose of this condition test is detecting if an instance of this script has already been running, if so, write a "rescan" flag to cause the already running script recan at the end of it, and exit the second script instance.
 
"$(</var/run/rebuildfstab.pid)" can't get the first running script's pid directory under /proc, and I don't know the usage of something like "$(<filename)". But if I write any string into "/var/run/rebuildfstab.pid", the "if []" condition is always "true".

I can get this work with "$(cat /var/run/rebuildfstab.pid)".
« Last Edit: March 09, 2012, 10:11:46 PM by littlebat »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 7900
Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« Reply #1 on: March 09, 2012, 11:44:16 PM »
It's shorthand syntax to avoid executing cat, ie to read the file in the current shell process. Seems it's indeed not working properly in ash, though.
The only barriers that can stop you are the ones you create yourself.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7344
  • Founder Emeritus
Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« Reply #2 on: March 10, 2012, 02:42:04 PM »
Suggested change accepted. Thanks!
10+ Years Contributing to Linux Open Source Projects.

Offline littlebat

  • Newbie
  • *
  • Posts: 25
Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« Reply #3 on: March 12, 2012, 07:26:30 PM »
It's shorthand syntax to avoid executing cat, ie to read the file in the current shell process. Seems it's indeed not working properly in ash, though.

Yes, "$(<filename)" can't work in /bin/sh->/bin/busbox, /bin/ash->/bin/busbox in Tinycore Linux, can't work in /bin/sh->/bin/dash in Debian Squezze. It can work in bash(tested in some distros).