Ticket #39286

Non-whitespace IFS character discarding empty fields

Open Date: 2019-06-02 14:05 Last Update: 2019-06-12 22:21

Reporter:
Owner:
Type:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

p()
for i
do
        printf '[%s]\n' "$i"
done

long=12345678123456781234567812345678
long=$long$long$long$long
export long
unset x
IFS=2
set ${x-${#long}}
p $* $#

This script should print:

[1]
[8]
[]


t=" x"
IFS="$t"
set x $t
echo $#

This script should print 2.

Ticket History (3/4 Histories)

2019-06-02 14:05 Updated by: magicant
  • New Ticket "Non-whitespace IFS character discarding empty fields" created
2019-06-07 22:47 Updated by: magicant
Comment

XCU 2.6 Word Expansions:

If the complete expansion appropriate for a word results in an empty field, that empty field shall be deleted from the list of fields that form the completely expanded command, unless the original word contained single-quote or double-quote characters.

So, yash's current behavior matches the spec. As other existing shells behave differently, the spec should be amended.

2019-06-09 11:42 Updated by: magicant
  • Resolution Update from None to Postponed
  • Priority Update from 5 - Medium to 3
2019-06-12 22:21 Updated by: magicant
  • Resolution Update from Postponed to None
  • Priority Update from 3 to 5 - Medium
Comment

After discussion with kre, I changed my mind to follow other shells' behavior.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login