Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 21:37:04 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 193759] Wrong behaviour of IFS='|' set in /bin/sh
Message-ID:  <bug-193759-8-esFEQmcvMy@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-193759-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-193759-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193759

Jilles Tjoelker <jilles@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Triage                |Issue Resolved
                 CC|                            |jilles@FreeBSD.org
         Resolution|---                         |Works As Intended
           Assignee|freebsd-bugs@FreeBSD.org    |jilles@FreeBSD.org

--- Comment #1 from Jilles Tjoelker <jilles@FreeBSD.org> ---
Thanks for your report. However, the behaviour is as designed and matches the
POSIX.1-2008 standard.

Firstly, assignments are performed after the command is expanded. Therefore, an
IFS= assignment preceding a command never affects word splitting of that
command itself.

Secondly, an assignment preceding a special built-in utility such as 'set'
remains in effect after the command completes. This explains why the second and
later commands work.

You need to set IFS before word splitting and possibly restore it later, or use
IFS=... read ... (where the assignment does affect read's splitting and does
not persist after the command completes).

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-193759-8-esFEQmcvMy>