Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110313 - /etc/init.d/netmount: unproper handling of variable "rcfilesystems"
Summary: /etc/init.d/netmount: unproper handling of variable "rcfilesystems"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All All
: High critical (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-24 04:58 UTC by Mark Dominik Bürkle
Modified: 2005-10-24 18:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Dominik Bürkle 2005-10-24 04:58:16 UTC
remove_net_fs() {
          local fs
          rcfilesystems=" ${rcfilesystems} "
          for fs in "$@" ; do
                  rcfilesystems=${rcfilesystems// ${fs} /}
          done
          rcfilesystems=${rcfilesystems# } # remove front and
          rcfilesystems=${rcfilesystems% } #   back spaces
  }

The action to remove one "fs" string is incorrect, it is removing one space too
much. It should be:
                  rcfilesystems=${rcfilesystems// ${fs} / }


Reproducible: Sometimes
Steps to Reproduce:
1.
2.
3.

Actual Results:  
Under certain circumstances, the script does not work properly.

Some filesystems/mountpoints (whatever the variable is used for) will be treated
in the wrong way.


assume
 - rcfilesystems="a b c d e f"
 - call remove_net_fs with parameters "c" "d" (or any combination in
"rcfilesystems" where one directly follows the other, another example would be
"a" "b" or "e" "f")

then the result would be "bd e f", "d" would not be removed.
So please replace:
                  rcfilesystems=${rcfilesystems// ${fs} /}
                  rcfilesystems=${rcfilesystems// ${fs} / }

Kind regards,
Dominik

Bugs bug#95752 and bug#109805 _could_ be related, but I didn't check.

Severity: MAY lead to data corruption (filesystems could not be umounted because
there were still nfs-mounts somewhere in a local partition) under certain
circumstances... I'd assign it a "normal" priority, but as it's so easy to fix,
I give it "Critical".
Comment 1 SpanKY gentoo-dev 2005-10-24 18:19:22 UTC
thanks, that is indeed wrong

fixed in svn