From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by sourceware.org (Postfix) with ESMTPS id 127213858D20 for ; Tue, 2 Apr 2024 06:18:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 127213858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSW.ab.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=SystematicSW.ab.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 127213858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=216.40.44.14 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 Received: from omf01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7C56E1C0A33 for ; Tue, 2 Apr 2024 06:18:42 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: Brian.Inglis@SystematicSW.ab.ca) by omf01.hostedemail.com (Postfix) with ESMTPA id 0484560010 for ; Tue, 2 Apr 2024 06:18:40 +0000 (UTC) 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 Reply-To: cygwin@cygwin.com Subject: Re: xargs completely broken under cygwin 3.6.0-0.108.gb7f5a33200a9 Content-Language: en-CA To: cygwin@cygwin.com References: From: Brian Inglis Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 List-Id: 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