delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/04/02/02:19:46

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34305385842A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1712038782;
bh=AIbC4emh64Bm0rE5Gpd1B1RlI8+tpkZtXEcqjy7znuA=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=v8B7+zLOMAJkVFGlZMixrEXGUuuRNhZxJhTqEaMTwayb7L8yWEfLX+fX+wgite7qh
/0CySD+JYQphSzrl8cirjz6a9uxufjrDNhHqeoVgYYFn19YhMmziQHre2GkkM1QY9/
27sHKdIZBGb3lNlz62iJPHXBufcAaTo5Vl9A369E=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 127213858D20
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 127213858D20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712038725; cv=none;
b=SIbNsWLsSXRFcsGj3VUwwaSvWdzd5nazeJ1JlJtPFaNyQjJP6vh2tWtfBtxmBflKYYjwMCzTqMIJmIP6eIPS+dud5Sqbmr/8xaohjJF9sh6Jp075YdYuwkOtDlnCOS9zXwCYhpoJEFJPeHa3ghefnUnM1Vw3VedSyL4t5gyosRQ=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1712038725; c=relaxed/simple;
bh=IxmzpzZeLMIvV86HdmnzxIaW8xYCAVdtwUEWZPS9hd0=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=qwSYkr7OXwTlfdmVmPMYOBiNh4LX0xXY+QEz/YcsrHHYsiL26SWDE6mEfI2ow6taavmq5z1yhgKomJnbhhnjC/M8JiEWWyUS+n3MUYxHML9hQXczNbzEUXrWXejYGUFoenci5OL9FSRAaPz0uIzmT3hhn51w5Ta6WQsOGZseouo=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <5780cde4-2d60-4f06-9246-c6e83b90cfd5@SystematicSW.ab.ca>
Date: Tue, 2 Apr 2024 00:18:40 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: xargs completely broken under cygwin 3.6.0-0.108.gb7f5a33200a9
To: cygwin AT cygwin DOT com
References: <a40780cc-82d1-4d00-7fa0-e11c9b1a96a1 AT gmail DOT com>
Organization: Systematic Software
In-Reply-To: <a40780cc-82d1-4d00-7fa0-e11c9b1a96a1@gmail.com>
X-Rspamd-Queue-Id: 0484560010
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP,
UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6
X-Rspamd-Server: rspamout02
X-Stat-Signature: 6cogn4ztd8io53hhtjb78eqbza6cz1ez
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX18O+SoI7BjrJgmWDH95eufOev9a31EhPWQ=
X-HE-Tag: 1712038720-631138
X-HE-Meta: U2FsdGVkX1/A690gM5DrDjA4UDD75MlijM/1GMwFRcenjeIL4U6DnJhR1bzL2NhKEsHKmJRMd2/nCx9VniXOtk7pNANb4j+aNJ5m/MI5qMgAL4M2iXzU1A/YbYwccbVBZ/VK33Zp8+fD5RHBijUe/7hWMd/Zivv5vRrTN7ZubT3spdQCWkTds0eBeADHoN24as5PuTyKcHGxh/14bxR+RnCkmAUc3PxDCkN+AomZJly0/mrlwYIG5stDrEtK3VAUTZdcEJ3SkVsNATC3NAytM4chiyHkgdi3E2zgTpoPhr/C3RWbauKwHEwXxnqpgU95tOXsPOaenaG14tQ3KEMrM9tKFgrcJHnfj/U9jFitv8dO7OIBqfQjsfD94a8rCQGqQ87yiE07VmENrUOSF/u3fQ==
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4326JjtN1693717

On 2024-04-01 21:36, Bruce Jerrick via Cygwin wrote:
> 'xargs' (part of 'findutils') is completely broken if
>    3.6.0-0.108.gb7f5a33200a9 (test version) is installed:
   ^ Cygwin
> 
>    $ xargs
>    xargs: Unexpected suffix cmdline on cmdline
> 
>    $ xargs --version
>    xargs: Unexpected suffix cmdline on cmdline
> 
>    $ echo narf | xargs echo
>    xargs: Unexpected suffix cmdline on cmdline
> 
> 'xargs' is from the current x86_64 findutils-4.9.0-1 .
> All other packages are up to date per setup.ini dated
>    2024-04-01 21:32:37 GMT.
> 
> I first discovered this under Windoze 11 Insider Preview
>    (with no other Cygwin test versions).
> On a Windoze 10 machine, it was OK with cygwin 3.5.1-1,
>    appeared when I installed 3.6.0-0.108.gb7f5a33200a9,
>    then went away when I reverted to 3.5.1-1 .
> (All machines are VMware VM's.)
> 
> ----------------------------------------------------------------
> 
> I have just started looking at the source, and the error
>    is coming from this snippet from 'safe_atoi()' in
>    lib/safe-atoi.c :

   ^ findutils 4.9.0

> safe_atoi (const char *s, enum quoting_style style)
> {
>    ...
>    lval = strtol (s, &end, 10);
>    ...
>    else if (*end)
>      {
>        die (EXIT_FAILURE, errno, _("Unexpected suffix %s on %s"),
>         quotearg_n_style (0, style, end),
>         quotearg_n_style (1, style, s));
>      }
>    ...

That function safe_atoi() appears only to be called by xargs from 
remember_non_cloexec_fds() -> get_max_fd() -> get_proc_max_fd(), all in 
lib/fdleak.c and appears to be trying to convert the text cmdline, which should 
not happen because it is trying to open, read, and convert directory entries 
from /proc/self/fd.

Could you please try running:

$ xargs -t --show-limits < /dev/null
Your environment variables take up 9285 bytes
POSIX upper limit on argument length (this system): 20667
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 11382
Size of command buffer we are actually using: 20667
Maximum parallelism (--max-procs must be no greater): 2147483647
echo

and it would be useful if you could run a failing command under strace e.g.

$ strace -o xargs.strace xargs -t --show-limits < /dev/null

or similar and attach as text to your reply.

There could be something funny going on with recent changes to Cygwin directory 
lookup affecting proc virtual file system lookups e.g.

Cygwin: implement dirent.d_reclen
https://cygwin.com/cgit/newlib-cygwin/commit/?h=topic/3.6&id=7e40e0169a75ebdf3f3861dab47abdfeb0ad9c58

and subsequent changes around dirents.

Could someone please take a look at those recent changes, testing access to proc 
file system entries, perhaps also with xargs, in case access to virtual files 
have issues?

>  From 'man 3 strtol":
>    "If the subject string is empty (or not in acceptable form),
>      no conversion is performed and the value of s is stored
>      in ptr [i.e., 'end'] ..."
> Which is apparently what is happening here.
> 
> I have yet to discover where "cmdline" is coming from (perhaps
>    /proc/%d/cmdline), let alone what it looks like.
> Further progress by me will depend on what success I have in
>    building 'findutils' from source :) .

For more info, install cygwin-doc, and run:
$ man 5 proc

Contents of /proc/.../cmdline is an argv array:

$ cat -A /proc/self/cmdline; echo
cat^@-A^@/proc/self/cmdline^@

There could also be something funny going on with recent changes to Cygwin 
process startup e.g.

Cygwin: redefine CW_CMDLINE to CW_CMDLINE_ALLOC
https://cygwin.com/cgit/newlib-cygwin/commit/?h=topic/3.6&id=732afede935832beab181ae421c1366df2ae6af5

Could someone please take a look at those recent changes, testing with xargs, in 
case base assumptions of argv[] command line arguments and environ, envp[] 
environment variables address locations, terminators, atexit routines, could be 
broken?

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019