Tiny Core Linux

Tiny Core Base => TCB Bugs => Topic started by: littlebat on March 10, 2012, 01:03:59 AM

Title: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
Post by: littlebat on March 10, 2012, 01:03:59 AM
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)".
Title: Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
Post by: curaga on March 10, 2012, 02:44:16 AM
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.
Title: Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
Post by: roberts on March 10, 2012, 05:42:04 PM
Suggested change accepted. Thanks!
Title: Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
Post by: littlebat on March 12, 2012, 11: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).