First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 29869
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: John Mylchreest (RETIRED) <johnm@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: evanm@frap.net
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 29869 depends on: Show dependency tree
Bug 29869 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2003-09-28 22:14 0000
When running mirrorselect and redirecting stdout, mirrorselect will truncate
the file that it's directed to. The error is in using /dev/std* for io
redirection, as the symlinks to /proc/self/fd/* symlink directly to the file
that i/o hasbeen redirected to, and mirrorselect will echo with a >, which will
always clobber the file. 

When used as per the install instructions, mirrorselect will destroy
/etc/make.conf!

A patch for this (untested) is located here:
http://frap.net/stuff/mirrorselect.patch

A log detailing the problem in action follows:

scale root # echo what >test
scale root # cat test
what
scale root # mirrorselect -a -s1 -o >> test
Downloading a list of mirrors...
Removing IPV6 Only Servers...
Running netselect to determine mirrors, this might take a moment...
netselect: unknown host mirror.iawnet.sandia.gov
netselect: unknown host mirrors.sec.informatik.tu-darmstadt.de
scale root # cat test
GENTOO_MIRRORS="ftp://gentoo.ccccom.com"
scale root # echo what >test
scale root # cat test
what
scale root # ./mirrorselect.fixed -a -s1 -o >> test
Downloading a list of mirrors...
Removing IPV6 Only Servers...
Running netselect to determine mirrors, this might take a moment...
netselect: unknown host mirror.iawnet.sandia.gov
scale root # cat test
what
GENTOO_MIRRORS="http://mirrors.tds.net/gentoo"
scale root # diff `which mirrorselect` mirrorselect.fixed
296c296
<               echo "${PATTERN}=\"${MIRRORS}\"" > /dev/stdout
---
>               echo "${PATTERN}=\"${MIRRORS}\"" # > /dev/stdout


/dev/std* must not be used in this manner!

------- Comment #1 From John Mylchreest (RETIRED) 2003-09-29 00:24:41 0000 -------
I have not modified mirrorselect for this test but...

# echo what > test
# mirrorselect -a -s15 -o >> test
Downloading a list of mirrors...
Removing IPV6 Only Servers...
Running netselect to determine mirrors, this might take a moment...
VHOST entries have been removed. This list might be shorter than expected
root@johnm johnm # cat test
what
GENTOO_MIRRORS="http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/ ftp://ftp.easynet.nl/mirror/gentoo/"

Do you results differ from this then?

------- Comment #2 From evanm@frap.net 2003-09-29 00:40:29 0000 -------
Yes, my results differ, and I've tested this on several machines. Are you
using version 0.82?

------- Comment #3 From John Mylchreest (RETIRED) 2003-09-29 08:55:58 0000 -------
yes i am.
# mirrorselect -v
Mirrorselect version: 0.82

Could you please remove the file from distfiles and try again.

------- Comment #4 From evanm@frap.net 2003-09-29 11:56:04 0000 -------
I removed /usr/sbin/mirrorselect, /var/tmp/portage/mirrorselect-0.82/ and
/usr/portage/distfiles/mirrorselect-0.82.tbz2, and then emerged it again.
I'm still having the same problem.

48e84253f50bdf970e889a0c7f398f32  /usr/sbin/mirrorselect

It's evident what the bug is. It can be re-created with this simple shell
script:

#!/bin/bash
ls -l /proc/self/fd/1 >&2
echo truncate > /dev/stdout

Ran like so:

scale root # echo data>test; ./iobug.sh >>test; cat test
lrwx------    1 root     root           64 Sep 29 11:57 /proc/self/fd/1 ->
/dev/pts/7
truncated

Any usage of /dev/std* symlinks will create this behavior.

------- Comment #5 From John Mylchreest (RETIRED) 2003-09-29 12:59:47 0000 -------
mirrorselect-0.82-r1 was just commited, with the new tarball propogating
shortly.
I have ammended it to redirect the same way you did in your patch, and i
have tested here.

The results i got with both versions are identical, however hopefully you
now should get the same results as myself.

Please test and report back, and then i shall close this bug.

------- Comment #6 From evanm@frap.net 2003-09-29 17:31:40 0000 -------
Works as expected now, thanks!


------- Comment #7 From John Mylchreest (RETIRED) 2003-09-30 08:31:20 0000 -------
fixed

First Last Prev Next    No search results available      Search page      Enter new bug