Bug 238762 - xargs -p only works in the POSIX locale
Summary: xargs -p only works in the POSIX locale
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Yuri Pankov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-22 12:46 UTC by Delan Azabani
Modified: 2020-12-24 23:39 UTC (History)
2 users (show)

See Also:
yuripv: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Delan Azabani 2019-06-22 12:46:52 UTC
# expected

$ echo test | xargs -t echo
echo test
test
$ echo test | xargs -p echo
echo test?...y
test

# actual

$ echo test | xargs -t echo
echo test
test
$ echo test | xargs -p echo
echo test?...y
$ locale; locale -k yesexpr
LANG=en_AU.UTF-8
LC_CTYPE="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_ALL=
yesexpr="^(([yY]([eE][sS])?)|([yY]))"
$ export LANG=POSIX
$ locale; locale -k yesexpr
LANG=POSIX
LC_CTYPE="POSIX"
LC_COLLATE="POSIX"
LC_TIME="POSIX"
LC_NUMERIC="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_ALL=
yesexpr="^[yY]"
$ echo test | xargs -p echo
echo test?...y
test
Comment 1 Yuri Pankov freebsd_committer 2020-12-08 07:06:35 UTC
The problem here is that yesexpr and noexpr are no longer BREs as xargs assumes.
Comment 2 commit-hook freebsd_committer 2020-12-12 15:38:48 UTC
A commit references this bug:

Author: yuripv
Date: Sat Dec 12 15:38:32 UTC 2020
New revision: 368580
URL: https://svnweb.freebsd.org/changeset/base/368580

Log:
  xargs: compile yesexpr as ERE

  yesexpr is an extended regular expression for quite some time now,
  use appropriate flag when compiling it.

  PR:		238762
  Reviewed by:	kevans
  Differential Revision:	https://reviews.freebsd.org/D27509

Changes:
  head/usr.bin/xargs/xargs.c