* rule_generator.functions: invalid PATH?
@ 2006-11-06 3:05 Bryan Kadzban
2006-11-06 20:20 ` Marco d'Itri
` (17 more replies)
0 siblings, 18 replies; 19+ messages in thread
From: Bryan Kadzban @ 2006-11-06 3:05 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1.1: Type: text/plain, Size: 780 bytes --]
At the start of the extras/rule_generator/rule_generator.functions file,
PATH is set to just "/sbin:/bin". However, the sysreadlink function
uses the readlink program from coreutils, which is (by default anyway)
installed in /usr/bin. The function also does not specify an explicit
path to readlink. sysreadlink therefore never works when readlink is in
/usr/bin.
Attached is a patch that adds /usr/bin to the end of the PATH. A
cursory inspection of the rest of the file doesn't show anything that
this will obviously break, though I don't know for sure. If it does
break something, an alternative would be to replace "readlink args" with
"/bin/readlink args || /usr/bin/readlink args". (Because I'm not sure
where various distros put readlink; some may move it to /bin.)
[-- Attachment #1.1.2: udev-103-rule_generator-PATH-fix.patch --]
[-- Type: text/plain, Size: 661 bytes --]
diff -Naur udev-103/extras/rule_generator/rule_generator.functions udev-103-patched/extras/rule_generator/rule_generator.functions
--- udev-103/extras/rule_generator/rule_generator.functions 2006-10-20 08:43:35.000000000 -0400
+++ udev-103-patched/extras/rule_generator/rule_generator.functions 2006-11-05 21:47:12.000000000 -0500
@@ -4,7 +4,7 @@
# under the terms of the GNU General Public License as published by the
# Free Software Foundation version 2 of the License.
-PATH='/sbin:/bin'
+PATH='/sbin:/bin:/usr/bin'
# Read a single line from file $1 in the $DEVPATH directory.
# The function must not return an error even if the file does not exist.
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
@ 2006-11-06 20:20 ` Marco d'Itri
2006-11-06 23:23 ` Bryan Kadzban
` (16 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Marco d'Itri @ 2006-11-06 20:20 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1: Type: text/plain, Size: 585 bytes --]
On Nov 06, Bryan Kadzban <bryan@kadzban.is-a-geek.net> wrote:
> At the start of the extras/rule_generator/rule_generator.functions file,
> PATH is set to just "/sbin:/bin". However, the sysreadlink function
> uses the readlink program from coreutils, which is (by default anyway)
> installed in /usr/bin. The function also does not specify an explicit
Not in Debian. One of the design requirements of the script was to not
require anything in /usr, which many not be mounted at the time it is
run.
Which distributions do not provide readlink in /bin?
--
ciao,
Marco
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
2006-11-06 20:20 ` Marco d'Itri
@ 2006-11-06 23:23 ` Bryan Kadzban
2006-11-06 23:42 ` Dan Nicholson
` (15 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Bryan Kadzban @ 2006-11-06 23:23 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1: Type: text/plain, Size: 714 bytes --]
Marco d'Itri wrote:
> Which distributions do not provide readlink in /bin?
Any that don't move it from the default coreutils source installation,
at least with coreutils-5.2.1 and -5.96. "./configure --prefix=/usr"
followed by "make install" from coreutils puts it in /usr/bin, along
with everything else. Most programs are probably then moved in most
distros (e.g. ls, rm, cp, ln), but at least Linux From Scratch (latest
stable and current SVN) does not include readlink in that list.
So LFS is one system that gets hit by this (I don't know if there are
any others). But from what you say about the script not requiring
anything in /usr, it sounds like a bug in LFS. I'll bring it up over
there. Thanks!
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
2006-11-06 20:20 ` Marco d'Itri
2006-11-06 23:23 ` Bryan Kadzban
@ 2006-11-06 23:42 ` Dan Nicholson
2006-11-07 11:35 ` Piter PUNK
` (14 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Dan Nicholson @ 2006-11-06 23:42 UTC (permalink / raw)
To: linux-hotplug
On 11/6/06, Marco d'Itri <md@linux.it> wrote:
> Which distributions do not provide readlink in /bin?
It doesn't look like Fedora does. Looking at the list of programs
moved to /bin, readlink isn't there. It's possible they don't install
readlink since it's not referenced in the spec at all.
http://cvs.fedora.redhat.com/viewcvs/devel/coreutils/coreutils.spec?view=markup
--
Dan
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (2 preceding siblings ...)
2006-11-06 23:42 ` Dan Nicholson
@ 2006-11-07 11:35 ` Piter PUNK
2006-11-07 11:39 ` Marco d'Itri
` (13 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 11:35 UTC (permalink / raw)
To: linux-hotplug
Marco d'Itri wrote:
> On Nov 06, Bryan Kadzban <bryan@kadzban.is-a-geek.net> wrote:
>> At the start of the extras/rule_generator/rule_generator.functions file,
>> PATH is set to just "/sbin:/bin". However, the sysreadlink function
>> uses the readlink program from coreutils, which is (by default anyway)
>> installed in /usr/bin. The function also does not specify an explicit
> Not in Debian. One of the design requirements of the script was to not
> require anything in /usr, which many not be mounted at the time it is
> run.
> Which distributions do not provide readlink in /bin?
Slackware 11: /usr/bin/readlink
RHEL 4: /usr/bin/readlink
SuSE 9 and 10: /usr/bin/readlink
LFS: /usr/bin/readlink
CentOS 4.4: /usr/bin/readlink
Fedora 4: /usr/bin/readlink
Gentoo, ArchLinux, Mandriva2007 and the Debian derived distros had the
readlink in /bin.
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (3 preceding siblings ...)
2006-11-07 11:35 ` Piter PUNK
@ 2006-11-07 11:39 ` Marco d'Itri
2006-11-07 11:44 ` Piter PUNK
` (12 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Marco d'Itri @ 2006-11-07 11:39 UTC (permalink / raw)
To: linux-hotplug
On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
> >Which distributions do not provide readlink in /bin?
And how many of these distributions actually support a stand-alone /usr?
The affected maintainers can easily modify the script.
--
ciao,
Marco
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (4 preceding siblings ...)
2006-11-07 11:39 ` Marco d'Itri
@ 2006-11-07 11:44 ` Piter PUNK
2006-11-07 12:22 ` Kay Sievers
` (11 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 11:44 UTC (permalink / raw)
To: linux-hotplug
Piter PUNK wrote:
> Marco d'Itri wrote:
>> Which distributions do not provide readlink in /bin?
>
> Slackware 11: /usr/bin/readlink
> RHEL 4: /usr/bin/readlink
> SuSE 9 and 10: /usr/bin/readlink
> LFS: /usr/bin/readlink
> CentOS 4.4: /usr/bin/readlink
> Fedora 4: /usr/bin/readlink
>
> Gentoo, ArchLinux, Mandriva2007 and the Debian derived distros had the
> readlink in /bin.
Ooops. Slackware had the readlink in /bin. The /usr/bin/readlink is a
symbolic link to the first one. The "which" command catch first the
/usr/bin/readlink. In RHEL 4 and CentOS the readlink is only in
/usr/bin. The SuSE machine isn't available to me now.
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (5 preceding siblings ...)
2006-11-07 11:44 ` Piter PUNK
@ 2006-11-07 12:22 ` Kay Sievers
2006-11-07 12:39 ` Piter PUNK
` (10 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kay Sievers @ 2006-11-07 12:22 UTC (permalink / raw)
To: linux-hotplug
On 11/7/06, Marco d'Itri <md@linux.it> wrote:
> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>
> > >Which distributions do not provide readlink in /bin?
> And how many of these distributions actually support a stand-alone /usr?
> The affected maintainers can easily modify the script.
Can't we do the silly "cd, pwd" trick we do in path_id?
Kay
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (6 preceding siblings ...)
2006-11-07 12:22 ` Kay Sievers
@ 2006-11-07 12:39 ` Piter PUNK
2006-11-07 12:42 ` Marco d'Itri
` (9 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 12:39 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On 11/7/06, Marco d'Itri <md@linux.it> wrote:
>> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>>
>>>> Which distributions do not provide readlink in /bin?
>> And how many of these distributions actually support a stand-alone /usr?
>> The affected maintainers can easily modify the script.
>
> Can't we do the silly "cd, pwd" trick we do in path_id?
Maybe it work:
sysreadlink() {
local file="$1"
local LINK=""
local i
[ -e "/sys$DEVPATH/$file" ] || return 0
cd /sys$DEVPATH
for i in `ls -la $i | grep \>`; do LINK="$i"; done
cd $LINK
/bin/pwd
}
I do a quick test with /block/hdc (my cdrom) and it works fine.
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (7 preceding siblings ...)
2006-11-07 12:39 ` Piter PUNK
@ 2006-11-07 12:42 ` Marco d'Itri
2006-11-07 12:56 ` Piter PUNK
` (8 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Marco d'Itri @ 2006-11-07 12:42 UTC (permalink / raw)
To: linux-hotplug
On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
> /bin/pwd
pwd is a shell built-in.
--
ciao,
Marco
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (8 preceding siblings ...)
2006-11-07 12:42 ` Marco d'Itri
@ 2006-11-07 12:56 ` Piter PUNK
2006-11-07 12:57 ` Kay Sievers
` (7 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 12:56 UTC (permalink / raw)
To: linux-hotplug
Marco d'Itri wrote:
> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>
>> /bin/pwd
> pwd is a shell built-in.
I don't know if all Bourne compatible shells have the 'pwd'
built-in. This is why i use /bin/pwd from coreutils. Looking
at path_id, it uses the built-in pwd. Probably it's safe to
use. Change /bin/pwd to pwd -;)
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (9 preceding siblings ...)
2006-11-07 12:56 ` Piter PUNK
@ 2006-11-07 12:57 ` Kay Sievers
2006-11-07 12:58 ` Marco d'Itri
` (6 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kay Sievers @ 2006-11-07 12:57 UTC (permalink / raw)
To: linux-hotplug
On 11/7/06, Marco d'Itri <md@linux.it> wrote:
> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>
> > /bin/pwd
> pwd is a shell built-in.
Right, and "pwd -P" returns the real path, without the need for the loop.
Kay
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (10 preceding siblings ...)
2006-11-07 12:57 ` Kay Sievers
@ 2006-11-07 12:58 ` Marco d'Itri
2006-11-07 13:09 ` Piter PUNK
` (5 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Marco d'Itri @ 2006-11-07 12:58 UTC (permalink / raw)
To: linux-hotplug
On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
> >pwd is a shell built-in.
> I don't know if all Bourne compatible shells have the 'pwd'
> built-in.
bash and dash do, and they are all the Bourne shells you need to care
about.
--
ciao,
Marco
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (11 preceding siblings ...)
2006-11-07 12:58 ` Marco d'Itri
@ 2006-11-07 13:09 ` Piter PUNK
2006-11-07 13:14 ` Marco d'Itri
` (4 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 13:09 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On 11/7/06, Marco d'Itri <md@linux.it> wrote:
>> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>>
>>> /bin/pwd
>> pwd is a shell built-in.
>
> Right, and "pwd -P" returns the real path, without the need for the loop.
sysreadlink() {
local file="$1"
local LINK=""
local i
[ -e "/sys$DEVPATH/$file" ] || return 0
cd /sys$DEVPATH/$file
pwd -P
}
Tested again with /block/hdc and works fine.
In dash "pwd -P" works fine?
Thanks for your help
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (12 preceding siblings ...)
2006-11-07 13:09 ` Piter PUNK
@ 2006-11-07 13:14 ` Marco d'Itri
2006-11-07 13:17 ` MUNEDA Takahiro
` (3 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Marco d'Itri @ 2006-11-07 13:14 UTC (permalink / raw)
To: linux-hotplug
On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
> sysreadlink() {
-> local file="$1"
-> local LINK=""
+ local OLD_DIRECTORY=$(pwd)
> local i
> [ -e "/sys$DEVPATH/$file" ] || return 0
> cd /sys$DEVPATH/$file
> pwd -P
+ cd "$OLD_DIRECTORY"
> }
The original $PWD must be restored.
> In dash "pwd -P" works fine?
Yes.
--
ciao,
Marco
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (13 preceding siblings ...)
2006-11-07 13:14 ` Marco d'Itri
@ 2006-11-07 13:17 ` MUNEDA Takahiro
2006-11-07 13:19 ` Piter PUNK
` (2 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: MUNEDA Takahiro @ 2006-11-07 13:17 UTC (permalink / raw)
To: linux-hotplug
At Tue, 07 Nov 2006 11:09:04 -0200,
Piter PUNK <piterpk@terra.com.br> wrote:
>
> Kay Sievers wrote:
> > On 11/7/06, Marco d'Itri <md@linux.it> wrote:
> >> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
> >>
> >>> /bin/pwd
> >> pwd is a shell built-in.
> >
> > Right, and "pwd -P" returns the real path, without the need for the loop.
>
> sysreadlink() {
> local file="$1"
> local LINK=""
> local i
> [ -e "/sys$DEVPATH/$file" ] || return 0
> cd /sys$DEVPATH/$file
> pwd -P
> }
>
> Tested again with /block/hdc and works fine.
> In dash "pwd -P" works fine?
If you do 'cd' /sys$DEVPATH/$file, I think it should be
[ -d "/sys$DEVPATH/$file" ] || return 0
Thanks,
MUNE
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (14 preceding siblings ...)
2006-11-07 13:17 ` MUNEDA Takahiro
@ 2006-11-07 13:19 ` Piter PUNK
2006-11-07 17:49 ` Piter PUNK
2006-11-07 17:55 ` Bryan Kadzban
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 13:19 UTC (permalink / raw)
To: linux-hotplug
Marco d'Itri wrote:
> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>
>> sysreadlink() {
> -> local file="$1"
> -> local LINK=""
> + local OLD_DIRECTORY=$(pwd)
>> local i
>> [ -e "/sys$DEVPATH/$file" ] || return 0
>> cd /sys$DEVPATH/$file
>> pwd -P
> + cd "$OLD_DIRECTORY"
>> }
>
> The original $PWD must be restored.
Oooops! Of course! Needs to remove the local i, too:
sysreadlink() {
local file="$1"
local OLD_DIRECTORY=$(pwd)
[ -e "/sys$DEVPATH/$file" ] || return 0
cd /sys$DEVPATH/$file
pwd -P
cd "$OLD_DIRECTORY"
}
This is OK to all now?
Thanks again for the help
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (15 preceding siblings ...)
2006-11-07 13:19 ` Piter PUNK
@ 2006-11-07 17:49 ` Piter PUNK
2006-11-07 17:55 ` Bryan Kadzban
17 siblings, 0 replies; 19+ messages in thread
From: Piter PUNK @ 2006-11-07 17:49 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
Hi,
This patch removes the readlink in rule_generator.functions.
The patch uses cd and built-in pwd, as pointed by Kay Sievers and
Marco D'Itri and the file exist test is changed from [ -e ] to
[ -d ] as pointed by Muneda Takahiro.
I hope it's ok now,
Piter PUNK
--
| E-Mail: piterpk@terra.com.br (personal)
.|. roberto.batista@ntux.com.br (professional)
/V\
// \\ UIN:116043354 Homepage:http://piterpunk.info02.com.br
/( )\
^`~'^ ----> Slackware Linux - The Best One! <----
#105432
[-- Attachment #2: remove_readlink.patch --]
[-- Type: text/plain, Size: 521 bytes --]
--- udev-103/extras/rule_generator/rule_generator.functions 2006-10-20 09:43:35.000000000 -0300
+++ udev-103pk/extras/rule_generator/rule_generator.functions 2006-11-07 15:38:13.000000000 -0200
@@ -18,8 +18,11 @@
sysreadlink() {
local file="$1"
- [ -e "/sys$DEVPATH/$file" ] || return 0
- readlink -f /sys$DEVPATH/$file 2> /dev/null || true
+ local OLD_DIRECTORY=$(pwd)
+ [ -d "/sys$DEVPATH/$file" ] || return 0
+ cd /sys$DEVPATH/$file
+ pwd -P
+ cd "$OLD_DIRECTORY"
}
# Return true if a directory is writeable.
[-- Attachment #3: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #4: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: rule_generator.functions: invalid PATH?
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
` (16 preceding siblings ...)
2006-11-07 17:49 ` Piter PUNK
@ 2006-11-07 17:55 ` Bryan Kadzban
17 siblings, 0 replies; 19+ messages in thread
From: Bryan Kadzban @ 2006-11-07 17:55 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1: Type: text/plain, Size: 709 bytes --]
On Tue, Nov 07, 2006 at 02:14:23PM +0100, Marco d'Itri wrote:
> On Nov 07, Piter PUNK <piterpk@terra.com.br> wrote:
>
> > sysreadlink() {
> -> local file="$1"
> -> local LINK=""
> + local OLD_DIRECTORY=$(pwd)
> > local i
> > [ -e "/sys$DEVPATH/$file" ] || return 0
> > cd /sys$DEVPATH/$file
> > pwd -P
> + cd "$OLD_DIRECTORY"
> > }
>
> The original $PWD must be restored.
What about pushd/popd? Or are those bash-only?
Also, instead of spawning a pwd for process substitution (even if it
is a shell builtin), you may be able to use the $PWD shell variable.
(As long as that's not bash-only too, which is possible.)
[-- Attachment #1.2: Type: application/pgp-signature, Size: 191 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2006-11-07 17:55 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 3:05 rule_generator.functions: invalid PATH? Bryan Kadzban
2006-11-06 20:20 ` Marco d'Itri
2006-11-06 23:23 ` Bryan Kadzban
2006-11-06 23:42 ` Dan Nicholson
2006-11-07 11:35 ` Piter PUNK
2006-11-07 11:39 ` Marco d'Itri
2006-11-07 11:44 ` Piter PUNK
2006-11-07 12:22 ` Kay Sievers
2006-11-07 12:39 ` Piter PUNK
2006-11-07 12:42 ` Marco d'Itri
2006-11-07 12:56 ` Piter PUNK
2006-11-07 12:57 ` Kay Sievers
2006-11-07 12:58 ` Marco d'Itri
2006-11-07 13:09 ` Piter PUNK
2006-11-07 13:14 ` Marco d'Itri
2006-11-07 13:17 ` MUNEDA Takahiro
2006-11-07 13:19 ` Piter PUNK
2006-11-07 17:49 ` Piter PUNK
2006-11-07 17:55 ` Bryan Kadzban
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).