Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24092 - new runscipts dependency scheme breaks when there are other invalid characters
Summary: new runscipts dependency scheme breaks when there are other invalid characters
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-08 00:57 UTC by Zhen Lin
Modified: 2003-10-26 09:48 UTC (History)
1 user (show)

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


Attachments
Patch to make all variable names safe (rc-md5sum.patch,1.17 KB, patch)
2003-07-08 02:47 UTC, Zhen Lin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhen Lin 2003-07-08 00:57:12 UTC
So far, the /lib/rcscripts/awk/gendepends.awk and
/lib/rcscripts/sh/rc-services.sh script catches '-' and '.' , but it should also
catch other characters, based on this definition:

name   A  word  consisting only of alphanumeric characters and underscores, and
beginning with an alphabetic character or an underscore.  Also referred to as an
identifier.

Therefore, it must also catch anything outside the set  ('0' to '9' union 'A' -
'Z' union 'a' - 'z' union '_') 

I propose that the names be hashed instead to avoid these problems. Will post
patches
Comment 1 Zhen Lin 2003-07-08 02:47:09 UTC
Created attachment 14266 [details, diff]
Patch to make all variable names safe

This patch changes depinfo_consolefont() into
depinfo_9a48feb4333a3dfac1d83f8a54a79c10() , etc. 

The hash is generated by md5sum'ing the name and a single newline, i.e. echo
"$myservice" | md5sum as opposed to echo -n "$myservice" | md5sum

Why I do this, you ask? It is because I have a service called timidity++-server
on my computer. Because of the change in the dependency generation scheme, rc
cannot find the dependency info for timidity++-server because '+' is not a
valid shell name character. A lot of other punctuation are not allowed in shell
names, but are allowed in file names.

So, this is the solution I come up with - a catch-almost-all solution. (' ' are
used to delimit the dependency information, this will require all names to be
hashed)
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-22 08:16:14 UTC
And that is going to call md5 and gawk a lot, meaning I can just as well revert
all the changes between 1.8.6.7 and 1.8.6.8, (meaning more forks, meaning slower,
especially on older machines) because it will be for naught.

Comment 3 Zhen Lin 2003-07-22 08:19:02 UTC
I know... Perhaps some embedded functions would be better.

The point is to stress that not all legal filenames are legal bash variable/function names.

I like the idea of letting bash to do the parsing of the deptree though.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-10-26 09:48:37 UTC
It now uses an array, and should fix this (commited to CVS).