IFS pollution from localpkg

Doug White dwhite at gumbysoft.com
Sat Oct 2 15:18:52 PDT 2004

Hey folks,

I ran into a build problem on my amd64 box today, where ar was being fed
output from a backtick operation but the carriage returns weren't being
converted to spaces.  After some gdb digging in sh, I found that the
reason for the problem was that IFS=" " was set in my shell environment.

Since I don't touch IFS in any of my shell dotfiles, and the system
shellfiles don't either, I think this may be coming from
/etc/rc.d/localpkg. It sets IFS just before calling the start script for
scripts in /usr/local/etc/rc.d/ and friends. I start kdm out of a script
there, and it probably inherits the environment, and it propagates all
the way up to my Konsole session where I was trying to build world.

Unsetting IFS made the buildworld continue past the prior point of

I'm not quite sure why this is only a problem on the amd64 machine -- it
was running a September 23 world, but is running KDE 3.3 instead of KDE
3.2 like the other machines I have here.  The system was also built from
scratch about that time, and the others have been around for 6 months or

I guess no one changes the script_name_sep rc.conf variable to something
more dangerous than the default space...

Anyway, I think we should investigate running local package scripts with
IFS (and other hazardous variables) stripped using env. Or perhaps not
play with IFS at all unless the user sets script_name_sep, and change the
default accordingly.

I'm not sure why this doesn't mess more stuff up :-/

Doug White                    |  FreeBSD: The Power to Serve
dwhite at gumbysoft.com          |  www.FreeBSD.org

More information about the freebsd-current mailing list