Bug 238762

Summary: xargs -p only works in the POSIX locale
Product: Base System Reporter: Delan Azabani <delan>
Component: binAssignee: Yuri Pankov <yuripv>
Status: Closed FIXED    
Severity: Affects Only Me CC: bugs, yuripv
Priority: --- Flags: yuripv: mfc-stable12+
Version: CURRENT   
Hardware: Any   
OS: Any   

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 freebsd_triage 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 freebsd_triage 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