WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline littlebat

  • Newbie
  • *
  • Posts: 25
/usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« 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)".
« Last Edit: March 10, 2012, 01:11:46 AM by littlebat »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« Reply #1 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.
The only barriers that can stop you are the ones you create yourself.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: /usr/sbin/rebuildfstab work wrong in Tinycore 4.3
« Reply #2 on: March 10, 2012, 05: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, 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).