From MAILER-DAEMON Thu Sep 01 02:29:32 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EAiZm-0001Ok-DO for mharc-bug-coreutils@gnu.org; Thu, 01 Sep 2005 02:29:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAVaI-0002B3-2X for bug-coreutils@gnu.org; Wed, 31 Aug 2005 12:37:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAVaA-00028E-Hr for bug-coreutils@gnu.org; Wed, 31 Aug 2005 12:37:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAVa9-00025H-Nf for bug-coreutils@gnu.org; Wed, 31 Aug 2005 12:37:01 -0400 Received: from [169.229.60.93] (helo=gateway0.EECS.Berkeley.EDU) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EAVTp-0006w8-Ec for bug-coreutils@gnu.org; Wed, 31 Aug 2005 12:30:29 -0400 Received: from argus.EECS.Berkeley.EDU (argus.EECS.Berkeley.EDU [128.32.42.200]) (authenticated bits=0) by gateway0.EECS.Berkeley.EDU (8.13.4/8.13.3) with ESMTP id j7VGRZDc004165 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 31 Aug 2005 09:27:39 -0700 (PDT) Date: Wed, 31 Aug 2005 09:27:35 -0700 (PDT) From: Ben Schwarz To: bug-coreutils@gnu.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Thu, 01 Sep 2005 02:29:27 -0400 Cc: David A Wagner Subject: Concerning a possible race condition in the 'coreutils' package X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2005 16:37:12 -0000 This email concerns a bug or security vulnerability that members of the MOPS project (http://www.cs.berkeley.edu/~daw/mops/) have found during a recent audit of all programs packaged with the Redhat 9 Linux distribution. We believe that one or more of the packages maintained by recipients of this email contain bugs that may be exploitable (although sometimes they are just bugs that may result in unexpected program behavior). The specific type of bug which we have found is a time-of-check to time-of-use vulnerability. These often occur when two system calls are performed that re-use the same literal pathname. For instance, an example of a vulnerability would be a setuid program that checks if a user has access to view a file (e.g., through the access() system call), and then opens the file (e.g., with open() ) if the user was deemed privileged. The problem is that this sequence of operations is not atomic, and access privileges could be changed between the two system calls. We present some examples of vulnerable programs in our paper "Model Checking An Entire Linux Distribution for Security Violations" which can be found at http://www.cs.berkeley.edu/~bschwarz/paper/mc-redhat.pdf. Section 3.1 is dedicated to this specific type of bug. Our suggestion for fixing these bugs is to not use fixed pathnames when accessing the file system, but rather file descriptors. File descriptors cannot be changed behind-the-scenes, so there cannot be race conditions. The maintainers of this package can find the interactive program traces at https://taverner.cs.berkeley.edu/traces/race/ A program trace consists of a series statements that caused the program to reach a state where we believe malicious behavior can occur. One can navigate the program code by clicking on transitions (two program states separated by a '->') in the leftmost pane to see the program behavior that caused our modelchecker to reach its final state. For this specific bug, transitions to the final "bug" state will occur after two system calls have been performed on a filename. We have manually audited these traces to verify that there are race conditions present. At this end of this email is a more detailed description of where the bug can be found. Any questions about this specific bug can be directed to bschwarz@cs.berkeley.edu. ---------------------------- URL with program traces for this package: https://taverner.cs.berkeley.edu/traces/race/coreutils-4.5.3-19/HTMLtrace/ Programs with bugs: chown (chown-core.c line 281) chown (chown-core.c line 342) chmod (chmod.c line 169) cp (cp.c line 489) From MAILER-DAEMON Thu Sep 01 11:31:01 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EAr1p-0003Al-D5 for mharc-bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:31:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAlyt-0005Uj-Kz for bug-coreutils@gnu.org; Thu, 01 Sep 2005 06:07:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAlyq-0005T0-SP for bug-coreutils@gnu.org; Thu, 01 Sep 2005 06:07:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAlyp-0005K1-Af for bug-coreutils@gnu.org; Thu, 01 Sep 2005 06:07:35 -0400 Received: from [63.125.26.116] (helo=ausmdms2.americas.corp.timex.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EAlxO-0006ok-Rn for bug-coreutils@gnu.org; Thu, 01 Sep 2005 06:06:06 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Thu, 1 Sep 2005 06:02:15 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: chown - Operation not permitted Thread-Index: AcWu3DskP3mddVr2QZihyTG+zVXjVA== X-Priority: 1 Priority: Urgent Importance: high From: "Kumar, Ashok" To: X-Mailman-Approved-At: Thu, 01 Sep 2005 11:30:59 -0400 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 10:07:41 -0000 Why can't a user change the ownership of his file. I need this to working. Can u please tell me the fix? =20 Regards, Ashok Kumar Timex, India Tel: + 91 120 2568668, 669 Ext: 233 Mobile: +91-9350001845 =20 From MAILER-DAEMON Thu Sep 01 11:38:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EAr98-0004zA-46 for mharc-bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:38:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAr93-0004vP-93 for bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:38:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAr8z-0004sw-2v for bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:38:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAr8y-0004jh-Mp for bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:38:24 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EAr3c-0006Zf-2C for bug-coreutils@gnu.org; Thu, 01 Sep 2005 11:32:52 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 903D24B2E8; Thu, 1 Sep 2005 09:29:53 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 6088B101CD0; Thu, 1 Sep 2005 09:29:53 -0600 (MDT) Date: Thu, 1 Sep 2005 09:29:53 -0600 To: "Kumar, Ashok" Message-ID: <20050901152953.GA22260@dementia.proulx.com> Mail-Followup-To: "Kumar, Ashok" , bug-coreutils@gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 15:38:30 -0000 Kumar, Ashok wrote: > Why can't a user change the ownership of his file. I need this to > working. Can u please tell me the fix? The GNU chown program will change the ownership if the operating system it is running upon allows it. If you can't change file ownership then it is the operating system which is restricting you and not the chown program. Please see this frequently given answer in the reference below. http://www.gnu.org/software/coreutils/faq/ Look for "Why can only root chown files?" Bob From MAILER-DAEMON Thu Sep 01 12:22:06 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EArpF-0005xT-ON for mharc-bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:22:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EArop-0005lR-D6 for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:21:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAroc-0005gA-K4 for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:21:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EArob-0005aH-Vb for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:21:26 -0400 Received: from [69.60.119.225] (helo=dessent.net) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EArfP-0002bF-Be for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:11:55 -0400 Received: from localhost ([127.0.0.1] helo=dessent.net) by dessent.net with esmtp (Exim 4.52) id 1EArcT-0001DZ-Lw for bug-coreutils@gnu.org; Thu, 01 Sep 2005 16:08:54 +0000 Message-ID: <43172899.A11E8287@dessent.net> Date: Thu, 01 Sep 2005 09:13:13 -0700 From: Brian Dessent Organization: My own little world... X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,en-US MIME-Version: 1.0 To: bug-coreutils@gnu.org References: <20050901152953.GA22260@dementia.proulx.com> Content-Type: multipart/mixed; boundary="------------155D651F1885071B29A8097C" Subject: Re: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 16:22:03 -0000 This is a multi-part message in MIME format. --------------155D651F1885071B29A8097C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Bob Proulx wrote: > Please see this frequently given answer in the reference below. > > http://www.gnu.org/software/coreutils/faq/ > > Look for "Why can only root chown files?" Incidently, there is an incomplete sentence in that section of the FAQ ("Such as creating..."). Brian --------------155D651F1885071B29A8097C Content-Type: text/plain; charset=us-ascii; name="coreutils-faq.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="coreutils-faq.patch" Index: coreutils-faq.texinfo =================================================================== RCS file: /webcvs/coreutils/coreutils/faq/coreutils-faq.texinfo,v retrieving revision 1.16 diff -u -r1.16 coreutils-faq.texinfo --- coreutils-faq.texinfo 13 Aug 2005 04:44:50 -0000 1.16 +++ coreutils-faq.texinfo 1 Sep 2005 16:07:07 -0000 @@ -351,7 +351,7 @@ @item A user can create files that they cannot remove. With the old semantics it was possible for normal users to create situations that only the -superuser could fix. Such as creating a non-writable directory of files +superuser could fix, such as creating a non-writable directory of files and then giving the ownership away. Since they no longer own the files they can't change them, nor can they remove them. This is commonly a problem when untaring files that other people created with restrictive --------------155D651F1885071B29A8097C-- From MAILER-DAEMON Thu Sep 01 12:57:27 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EAsNS-0003bP-7P for mharc-bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:57:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAsNP-0003a4-PS for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:57:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAsNL-0003Y8-Fv for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:57:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAsNK-0003Ig-Di for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:57:18 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EAsIg-0005gi-Q9 for bug-coreutils@gnu.org; Thu, 01 Sep 2005 12:52:31 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 9F5184B2E8 for ; Thu, 1 Sep 2005 10:49:29 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 999EF111A69; Thu, 1 Sep 2005 10:49:29 -0600 (MDT) Date: Thu, 1 Sep 2005 10:49:29 -0600 To: bug-coreutils@gnu.org Message-ID: <20050901164929.GA14613@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <20050901152953.GA22260@dementia.proulx.com> <43172899.A11E8287@dessent.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43172899.A11E8287@dessent.net> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: FAQ grammar fix (was: chown - Operation not permitted) X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 16:57:25 -0000 Brian Dessent wrote: > Incidently, there is an incomplete sentence in that section of the FAQ > ("Such as creating..."). Fixed! Thanks Bob > Brian > Index: coreutils-faq.texinfo > =================================================================== > RCS file: /webcvs/coreutils/coreutils/faq/coreutils-faq.texinfo,v > retrieving revision 1.16 > diff -u -r1.16 coreutils-faq.texinfo > --- coreutils-faq.texinfo 13 Aug 2005 04:44:50 -0000 1.16 > +++ coreutils-faq.texinfo 1 Sep 2005 16:07:07 -0000 > @@ -351,7 +351,7 @@ > @item > A user can create files that they cannot remove. With the old semantics > it was possible for normal users to create situations that only the > -superuser could fix. Such as creating a non-writable directory of files > +superuser could fix, such as creating a non-writable directory of files > and then giving the ownership away. Since they no longer own the files > they can't change them, nor can they remove them. This is commonly a > problem when untaring files that other people created with restrictive From MAILER-DAEMON Fri Sep 02 00:44:13 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EB3PR-00045D-Ae for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:44:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAthz-0004I0-1q for bug-coreutils@gnu.org; Thu, 01 Sep 2005 14:22:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAthr-0004EN-SZ for bug-coreutils@gnu.org; Thu, 01 Sep 2005 14:22:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAthp-00049s-St for bug-coreutils@gnu.org; Thu, 01 Sep 2005 14:22:34 -0400 Received: from [64.14.54.233] (helo=ext-nj2ut-4.online-age.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EAtW8-0002n2-73 for bug-coreutils@gnu.org; Thu, 01 Sep 2005 14:10:28 -0400 Received: from int-nj2ut-3.online-age.net (int-nj2ut-3.online-age.net [3.159.237.72]) by ext-nj2ut-4.online-age.net (8.12.11/8.12.10/20050401-SVVS) with ESMTP id j81HsGx8002529 for ; Thu, 1 Sep 2005 12:54:19 -0500 Received: from cinmlef05.e2k.ad.ge.com (localhost.localdomain [127.0.0.1]) by int-nj2ut-3.online-age.net (8.11.6/8.11.6/20050510-SVVS) with ESMTP id j81HrpT21118 for ; Thu, 1 Sep 2005 12:53:51 -0500 Received: from stamlvem03.e2k.ad.ge.com ([3.159.9.35]) by cinmlef05.e2k.ad.ge.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 1 Sep 2005 14:06:54 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 1 Sep 2005 14:07:08 -0400 Message-ID: <2AFF70EB1B348D4C8BB2F71C415A18BE0F7BC5FC@STAMLVEM03.e2k.ad.ge.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Hi .. Thread-Index: AcWvH/b4kNw098xcSeiS4mlqikpjIQ== From: "Satpathy, Ajay \(Corporate, consultant\)" To: X-OriginalArrivalTime: 01 Sep 2005 18:06:54.0398 (UTC) FILETIME=[EF532DE0:01C5AF1F] X-Mailman-Approved-At: Fri, 02 Sep 2005 00:44:11 -0400 Subject: Hi .. X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 18:22:43 -0000 Hi, We use nohup command in Linux environment to start a process in back = ground. This process must run continuously until the process is killed. = We notice that the process is running fine for some time and then stops = automatically on its own. We have no clue how the process is stopped. Is there any way to know why the process gets stopped on its own, is = there any Linux log will say that ? This process is running fine in Unix = environment. I use following command to start the process: $ nohup ${CHECKIN_TOP}/scripts/mars_checkin_daemon.sh & I check if the process is running, I see it is running. $ ps -ef|grep mars_check marsdev 4572 1 3 Aug30 pts/0 01:40:32 /bin/ksh = /d002/u17/app01/mard/ma rsdev/scripts/mars_checkin_daemon.sh marsdev 1417 4392 0 10:13 pts/0 00:00:00 grep mars_check After say few hours when I check if the process is running, I see it is = not running. $ ps -ef|grep mars_check marsdev 1417 4392 0 10:13 pts/0 00:00:00 grep mars_check Thanks, Ajay From MAILER-DAEMON Fri Sep 02 00:44:13 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EB3PR-00045L-Gv for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:44:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB39Z-0007z2-DG for bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:27:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB39X-0007xx-29 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:27:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB39W-0007wc-20 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:27:46 -0400 Received: from [63.125.26.116] (helo=ausmdms2.americas.corp.timex.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB35o-0004HC-3y for bug-coreutils@gnu.org; Fri, 02 Sep 2005 00:23:56 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Sep 2005 00:19:53 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: chown - Operation not permitted Thread-Index: AcWvCgXeOEj8B2lcTYOI5ooFs4pw0gAayREg From: "Kumar, Ashok" To: "Bob Proulx" X-Mailman-Approved-At: Fri, 02 Sep 2005 00:44:11 -0400 Cc: bug-coreutils@gnu.org Subject: RE: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 04:27:49 -0000 Thanks a lot for quick reply. We are running on RedHat AS 3.2.=20 [root@whdb3 root]# cat /proc/version Linux version 2.4.21-27.0.4.ELsmp (bhcompile@porky.build.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 SMP Sat Apr 16 18:43:06 EDT 2005 Do we have any fix or workaround (preferably fix) for the same. Regards, Ashok Kumar Timex, India Tel: + 91 120 2568668, 669 Ext: 233 Mobile: +91-9350001845 -----Original Message----- From: Bob Proulx [mailto:bob@proulx.com]=20 Sent: Thursday, September 01, 2005 9:00 PM To: Kumar, Ashok Cc: bug-coreutils@gnu.org Subject: Re: chown - Operation not permitted Kumar, Ashok wrote: > Why can't a user change the ownership of his file. I need this to > working. Can u please tell me the fix? The GNU chown program will change the ownership if the operating system it is running upon allows it. If you can't change file ownership then it is the operating system which is restricting you and not the chown program. Please see this frequently given answer in the reference below. http://www.gnu.org/software/coreutils/faq/ Look for "Why can only root chown files?" Bob From MAILER-DAEMON Fri Sep 02 01:54:16 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EB4VC-0001Wn-W9 for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:54:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB4V5-0001U4-1U for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:54:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB4Uy-0001Qe-7e for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:54:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB4Ux-0001Q5-EE for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:53:59 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB4TA-0008Ua-73 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:52:08 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id DD7A34B2E8; Thu, 1 Sep 2005 23:49:00 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id BD94D1539D3; Thu, 1 Sep 2005 23:49:00 -0600 (MDT) Date: Thu, 1 Sep 2005 23:49:00 -0600 To: "Satpathy, Ajay (Corporate, consultant)" Message-ID: <20050902054900.GB30056@dementia.proulx.com> Mail-Followup-To: "Satpathy, Ajay (Corporate, consultant)" , bug-coreutils@gnu.org References: <2AFF70EB1B348D4C8BB2F71C415A18BE0F7BC5FC@STAMLVEM03.e2k.ad.ge.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2AFF70EB1B348D4C8BB2F71C415A18BE0F7BC5FC@STAMLVEM03.e2k.ad.ge.com> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: unix daemon (was: Hi ..) X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 05:54:08 -0000 Satpathy, Ajay (Corporate, consultant) wrote: > We use nohup command in Linux environment to start a process in back > ground. This process must run continuously until the process is killed. We > notice that the process is running fine for some time and then stops > automatically on its own. We have no clue how the process is stopped. We don't have a clue as to why your program is exiting either. > Is there any way to know why the process gets stopped on its own, is there > any Linux log will say that ? This process is running fine in Unix > environment. You will have to debug it. There is no way for us to know what is in your script. There are many differences between systems. Writing portable scripts can be a challenge at times. If this behaves differently between two different systems then it is obviously sensitive in some way to the underlying system differences. > I use following command to start the process: > $ nohup ${CHECKIN_TOP}/scripts/mars_checkin_daemon.sh & > > I check if the process is running, I see it is running. > $ ps -ef|grep mars_check > marsdev 4572 1 3 Aug30 pts/0 01:40:32 /bin/ksh /d002/u17/app01/mard/marsdev/scripts/mars_checkin_daemon.sh Unfortunately as you can see it is still associated with a tty device. In this case pts/0. Before job control a unix task could be placed in the background with nohup as you show and that would be fine. But on job control systems this is no longer sufficient. On job control systems the process is still attached to the tty. You should disassociate from the controlling terminal. The Perl Cookbook if I recall correctly has an example of doing this. But I don't have a copy handy to look. > After say few hours when I check if the process is running, I see it is not > running. > $ ps -ef|grep mars_check > marsdev 1417 4392 0 10:13 pts/0 00:00:00 grep mars_check The process has apparently exited. You will have to debug it. There is nothing we can do here to help you with this. Bob From MAILER-DAEMON Fri Sep 02 01:56:33 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EB4XP-0002AK-CO for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB4XL-00028C-1w for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB4X2-000215-58 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB4Wz-0001Q5-EZ for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:06 -0400 Received: from [63.125.26.116] (helo=ausmdms2.americas.corp.timex.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB46y-0007gF-RN for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:29:13 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Sep 2005 01:25:12 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: chown - Operation not permitted Thread-Index: AcWvfmwRujzUVukoTmaBMViZaQYoIAAADHXA From: "Kumar, Ashok" To: Subject: RE: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 05:56:29 -0000 Thanks a lot. Regards, Ashok Kumar Timex, India Tel: + 91 120 2568668, 669 Ext: 233 Mobile: +91-9350001845 -----Original Message----- From: Bob Proulx [mailto:bob@proulx.com]=20 Sent: Friday, September 02, 2005 10:53 AM To: Kumar, Ashok Cc: bug-coreutils@gnu.org Subject: Re: chown - Operation not permitted Kumar, Ashok wrote: > Thanks a lot for quick reply. We are running on RedHat AS 3.2.=20 > > [root@whdb3 root]# cat /proc/version > Linux version 2.4.21-27.0.4.ELsmp (bhcompile@porky.build.redhat.com) > (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 SMP Sat Apr 16 > 18:43:06 EDT 2005 >=20 > Do we have any fix or workaround (preferably fix) for the same. I think you missed the explanation that this is not broken behavior. It is not a bug. So there is nothing to fix. It is working the way it is supposed to work. This is not distro specific. POSIX requires this behavior. All of the current operating systems running a modern kernel and claiming POSIX conformance behave this way. man posixoptions --- - POSIX_CHOWN_RESTRICTED If this option is in effect (as it always is under POSIX 1003.1-2001) then only root may change the owner of a file, and non-root can only set the group of a file to one of the groups it belongs to. This affects the functions chown(), fchown(). Although it is possible to modify the linux kernel configuration and compile it without this capability I recommend against it. Instead I suggest you look at the 'sudo' command. This allows you to delegate root access in less than global ways. man sudo Bob From MAILER-DAEMON Fri Sep 02 01:59:05 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EB4Zr-0002Y6-Ko for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:59:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB4Xh-0002Ep-Pt for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB4XN-00028p-Ak for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB4XK-0001Q5-OY for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:56:27 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB446-0007bK-Fi for bug-coreutils@gnu.org; Fri, 02 Sep 2005 01:26:15 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id EFA8F4B2E8; Thu, 1 Sep 2005 23:23:05 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id E23FC1539BE; Thu, 1 Sep 2005 23:23:05 -0600 (MDT) Date: Thu, 1 Sep 2005 23:23:05 -0600 To: "Kumar, Ashok" Message-ID: <20050902052305.GA30056@dementia.proulx.com> Mail-Followup-To: "Kumar, Ashok" , bug-coreutils@gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: chown - Operation not permitted X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 05:58:59 -0000 Kumar, Ashok wrote: > Thanks a lot for quick reply. We are running on RedHat AS 3.2. > > [root@whdb3 root]# cat /proc/version > Linux version 2.4.21-27.0.4.ELsmp (bhcompile@porky.build.redhat.com) > (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 SMP Sat Apr 16 > 18:43:06 EDT 2005 > > Do we have any fix or workaround (preferably fix) for the same. I think you missed the explanation that this is not broken behavior. It is not a bug. So there is nothing to fix. It is working the way it is supposed to work. This is not distro specific. POSIX requires this behavior. All of the current operating systems running a modern kernel and claiming POSIX conformance behave this way. man posixoptions --- - POSIX_CHOWN_RESTRICTED If this option is in effect (as it always is under POSIX 1003.1-2001) then only root may change the owner of a file, and non-root can only set the group of a file to one of the groups it belongs to. This affects the functions chown(), fchown(). Although it is possible to modify the linux kernel configuration and compile it without this capability I recommend against it. Instead I suggest you look at the 'sudo' command. This allows you to delegate root access in less than global ways. man sudo Bob From MAILER-DAEMON Fri Sep 02 10:27:23 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBCVn-0003jt-Kt for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 10:27:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB7lv-00005R-UO for bug-coreutils@gnu.org; Fri, 02 Sep 2005 05:23:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB7ls-00004r-Up for bug-coreutils@gnu.org; Fri, 02 Sep 2005 05:23:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB7lr-0008UI-26 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 05:23:39 -0400 Received: from [81.169.145.165] (helo=natsmtp00.rzone.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB7jF-0005xj-Vy for bug-coreutils@gnu.org; Fri, 02 Sep 2005 05:20:58 -0400 Received: from foreveryoung (p54AF73B7.dip.t-dialin.net [84.175.115.183]) by post.webmailer.de (8.13.1/8.13.1) with ESMTP id j829Hi7G002610 for ; Fri, 2 Sep 2005 11:17:45 +0200 (MEST) Message-Id: <200509020917.j829Hi7G002610@post.webmailer.de> From: "Matzwelt.info" To: Date: Fri, 2 Sep 2005 11:17:37 +0200 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcWvnyjXRSVUbm/mSAusJi2EqUSApA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Mailman-Approved-At: Fri, 02 Sep 2005 10:27:22 -0400 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: df: Wrong Gigabyte-Output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 09:23:44 -0000 ich saw this Problem after Dist-Upgrade (aptitude) from Debian 3.0 = (woody) to Debian 3.1 (sarge). 3304 MB must be output 3,2(265625) GB on df -h. I = had the same Problem with 1 GB partion (hda3). 1049??? (df), 1026 MB (df = -m), 1.1 GB (df -h) # Afer i resize the Partion with parted on 1018MB (df = -m), df -h shows me 1018MB and not 1GB. As 1GB doesn=B4t exsist. server:/# df Dateisystem 1K-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt auf /dev/hda3 3382340 543928 2804036 17% / tmpfs 515716 0 515716 0% /dev/shm /dev/hda1 54416 8175 45680 16% /boot server:/# df -m Dateisystem 1M-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt auf /dev/hda3 3304 532 2739 17% / tmpfs 504 0 504 0% /dev/shm /dev/hda1 54 8 45 16% /boot server:/# df -h Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 3,3G 532M 2,7G 17% / tmpfs 504M 0 504M 0% /dev/shm /dev/hda1 54M 8,0M 45M 16% /boot server:/# df -H Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 3,5G 557M 2,9G 17% / tmpfs 529M 0 529M 0% /dev/shm /dev/hda1 56M 8,4M 47M 16% /boot ######### On my Testserver at home the same problem: admin@server:/$ df Dateisystem 1K-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt auf /dev/hda3 1580852 628741 867770 43% / tmpfs 31304 0 31304 0% /dev/shm /dev/hda1 52659 22323 27527 45% /boot admin@server:/$ df -m Dateisystem 1M-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt auf /dev/hda3 1544 615 848 43% / tmpfs 31 0 31 0% /dev/shm /dev/hda1 52 22 27 45% /boot admin@server:/$ df -h Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 1,6G 615M 848M 43% / tmpfs 31M 0 31M 0% /dev/shm /dev/hda1 52M 22M 27M 45% /boot admin@server:/$ df -H Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 1,7G 644M 889M 43% / tmpfs 33M 0 33M 0% /dev/shm /dev/hda1 54M 23M 29M 45% /boot Greetings from Germany. From MAILER-DAEMON Fri Sep 02 14:41:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBGTz-0007kH-Mz for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:41:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBGTw-0007j6-HI for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:41:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBGSZ-0007Ja-Co for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:40:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBGSZ-00071v-1L for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:40:19 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBGRM-0004Mk-W4 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:39:05 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j82IZh420666; Fri, 2 Sep 2005 11:35:43 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EBGNs-000104-3P; Fri, 02 Sep 2005 11:35:28 -0700 To: Sorav Bansal References: <42D5BFF7.6060003@stanford.edu> <20050714075101.GB2390@excession.spiral-arm.org> <87y889cqo2.fsf@penguin.cs.ucla.edu> <85br54wjss.fsf@pi.meyering.net> <42DFAC6E.2020908@stanford.edu> <87ll3zvhht.fsf@penguin.cs.ucla.edu> <42E18514.5080005@stanford.edu> <87fyu6owpz.fsf@penguin.cs.ucla.edu> <42E5E4B4.4080708@stanford.edu> From: Paul Eggert Date: Fri, 02 Sep 2005 11:35:28 -0700 In-Reply-To: <42E5E4B4.4080708@stanford.edu> (Sorav Bansal's message of "Tue, 26 Jul 2005 00:22:28 -0700") Message-ID: <87y86fgvwv.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: bsearch utility X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 18:41:46 -0000 Sorav Bansal writes: > I have now ported look.c to the latest CVS repository too. In doing > so, I noticed that the new keycompare() function no longer calls > 'trim_trailing_blanks()'. Its not clear to me, why these calls are not > necessary anymore. Is that because if the keys match till the last > non-blank character, then you allow the number of trailing blanks to > be considered as a tie-breaker? Yes. POSIX requires this and other 'sort' implementations do it that way, so we thought it better to be compatible. Please see the 2004-04-25 ChangeLog entry. > These calls are needed for 'look' though. For now, I am adding the > calls and commenting with XXX in compare.h. I guess they'll need to be conditional on whether it's 'look' rather than 'sort'. >>I don't see the need for the -B option, or the -l option. Can't >>we omit them? >> > I thought '-l' could be useful for looking into unsorted files. '-B' > can be used for setting the buffer size which affects performance, > especially when doing linear search. But doesn't 'grep' do the same job that look -l would? Perhaps I'm missing something here. > However, I agree that they are not particularly necessary. OK, then (unless I'm missing something) let's please omit them for now. We can always put them in later if there's a need. Speaking of which, the most important thing needed for this change is documentation. We need a section in doc/coreutils.texi. I'd put it just after the 'tsort invocation' section. Also, a couple of lines in NEWS. >>Isn't fseeko kind of a loser, performance-wise? Wouldn't it >>be faster if you used lseek, and took block boundaries into >>account? I suppose this is more of a tuning thing tho. >> > How do you propose using block boundaries into account? I am not sure > what you mean, so I am leaving the fseeko() calls in place right now. For POSIX-conformance reasons, fseeko is required to do an underlying lseek to the exact same position; in effect, buffering is turned off. Thus you'll often get better performance by seeking to buffer boundaries, even if you use fseeko. Often it's easier just to use lseek. This is just a performance issue, not a correctness issue, so we shouldn't let it slow us down too much. Better to get it right (first) and then speed it up. (But I thought I'd mention it anyway. :-) > This time, I have tried my best to match the style in > coreutils. Please point me to specific areas where I am not conforming > to the coding style and I would be glad to correct them. These are all fairly minor, but they'll have to be done anyway so we appreciate your help. Comments should look like this: /* Use English sentences. Break long lines like this. Put two spaces after each period. */ Prefer "const *" to "*". Don't use "register". Don't put a space before ";". Don't parenthesize the expression X in "return X;". Use x2realloc or x2nrealloc to double a buffer's size, instead of checking for size overflow by hand. Prefer 'bool' to 'int' where either will do. Thanks again for helping with this! From MAILER-DAEMON Fri Sep 02 15:30:03 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBHEh-0001Q2-3I for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:30:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBHEc-0001OZ-3i for bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:29:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBH83-0000Fm-NA for bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:23:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBH81-0008W0-6x for bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:23:09 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBGs3-0006YV-Df for bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:06:39 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j82J37422998; Fri, 2 Sep 2005 12:03:07 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EBGoN-00010T-Vf; Fri, 02 Sep 2005 12:02:51 -0700 To: "Matzwelt.info" References: <200509020917.j829Hi7G002610@post.webmailer.de> From: Paul Eggert Date: Fri, 02 Sep 2005 12:02:51 -0700 In-Reply-To: <200509020917.j829Hi7G002610@post.webmailer.de> (Matzwelt info's message of "Fri, 2 Sep 2005 11:17:37 +0200") Message-ID: <87hdd3gun8.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: df: Wrong Gigabyte-Output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 19:29:58 -0000 "Matzwelt.info" writes: > ich saw this Problem after Dist-Upgrade (aptitude) from Debian 3.0 (woody) > to Debian 3.1 (sarge). 3304 MB must be output 3,2(265625) GB on df -h. I don't see a bug here. As I understand it, you had 3,463,516,160 bytes on your partition, which is about 3303.07 MiB (one MiB == 2**20 bytes). df always rounds up (POSIX requires this) so it rounds up the total to 3304 MiB-blocks. That same total is also equal to about 3.23 GiB (one GiB == 2**30 bytes), so df -h's "3,3G" is also correctly rounded up. Also, df -H's "3,5G" is also correctly rounded up, since the actual value is about 3.46 GB. Does this explain what you observed? If not, please clarify. Thanks. From MAILER-DAEMON Fri Sep 02 15:39:34 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBHNt-0004Tk-SH for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 15:39:33 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBGTu-0007hu-6w for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:41:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBGSZ-0007J9-0s for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:40:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBGSU-00071v-Ne for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:40:15 -0400 Received: from [65.54.175.38] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBGC1-0003SV-3V for bug-coreutils@gnu.org; Fri, 02 Sep 2005 14:23:13 -0400 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 2 Sep 2005 11:19:58 -0700 Message-ID: Received: from 65.54.175.203 by by104fd.bay104.hotmail.msn.com with HTTP; Fri, 02 Sep 2005 18:19:58 GMT X-Originating-IP: [65.54.175.203] X-Originating-Email: [alihamzaraza@hotmail.com] X-Sender: alihamzaraza@hotmail.com From: "Ali Hamza" To: bug-coreutils@gnu.org Bcc: Date: Fri, 02 Sep 2005 18:19:58 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 02 Sep 2005 18:19:58.0302 (UTC) FILETIME=[ECFB2FE0:01C5AFEA] X-Mailman-Approved-At: Fri, 02 Sep 2005 15:39:32 -0400 Subject: Configure Problem X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 18:41:42 -0000 I m building LFS Version 5.2.1. In chapter six when i configured coreutils-5.2.1. with DEFAULT_POSIX2_VERSION=199209 ./configure --prefix =/usr command i received the following error message configure: error: expected an absolute directory name for --prefix: =/usr i dont know why is it so.... please help me

Man Can Change His Own Life

 

From MAILER-DAEMON Fri Sep 02 16:35:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBIGP-0000Pi-L8 for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:35:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBIGO-0000PL-44 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:35:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBIGM-0000Ox-EB for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:35:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBIFQ-0008To-VD for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:34:53 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBHp4-0001si-DU for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:07:38 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j82K4L428599; Fri, 2 Sep 2005 13:04:21 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EBHle-00012d-Ip; Fri, 02 Sep 2005 13:04:06 -0700 To: "Ali Hamza" References: From: Paul Eggert Date: Fri, 02 Sep 2005 13:04:06 -0700 In-Reply-To: (Ali Hamza's message of "Fri, 02 Sep 2005 18:19:58 +0000") Message-ID: <874q93fd8p.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: Configure Problem X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 20:35:52 -0000 "Ali Hamza" writes: > DEFAULT_POSIX2_VERSION=199209 ./configure --prefix =/usr Omit the space before the '='. E.g.: DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/usr From MAILER-DAEMON Fri Sep 02 16:39:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBIKE-0001wr-J8 for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:39:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBIKC-0001wA-UP for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:39:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBIKB-0001vG-Hc for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:39:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBIFR-0008To-B1 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:34:53 -0400 Received: from [80.68.81.132] (helo=bigben2.bytemark.co.uk) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EBHoW-0001rO-L2 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:07:04 -0400 Received: from [80.68.89.77] (helo=excession.spiral-arm.org) by bigben2.bytemark.co.uk with esmtp (Exim 4.52) id 1EBHlN-0003DV-0S; Fri, 02 Sep 2005 20:03:49 +0000 Received: by excession.spiral-arm.org (Postfix, from userid 1000) id A04488B66; Fri, 2 Sep 2005 21:13:39 +0100 (BST) Date: Fri, 2 Sep 2005 21:13:39 +0100 To: Ali Hamza Message-ID: <20050902201339.GA31310@excession.spiral-arm.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: jay@excession.spiral-arm.org (James Youngman) Cc: bug-coreutils@gnu.org Subject: Re: Configure Problem X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 20:39:49 -0000 On Fri, Sep 02, 2005 at 06:19:58PM +0000, Ali Hamza wrote: > DEFAULT_POSIX2_VERSION=199209 ./configure --prefix =/usr > command i received the following error message > > configure: error: expected an absolute directory name for --prefix: =/usr > > i dont know why is it so.... Try removing the spurious space in your command, giving: ./configure --prefix=/usr or use the space without "=": ./configure --prefix /usr Either of these should solve your problem. The way you have it, "=" is being interpreted as the first character of the path name (don't forget that "=" is legal as a directory name). James. From MAILER-DAEMON Fri Sep 02 20:38:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBM3R-0004sr-AJ for mharc-bug-coreutils@gnu.org; Fri, 02 Sep 2005 20:38:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBIUT-0005AK-DG for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:50:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBIUC-00056E-F6 for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:50:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBIU8-00051a-WE for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:50:05 -0400 Received: from [81.169.145.161] (helo=natfrord.rzone.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBIJO-0003lr-CA for bug-coreutils@gnu.org; Fri, 02 Sep 2005 16:38:58 -0400 Received: from foreveryoung (p54AF73B7.dip.t-dialin.net [84.175.115.183]) (authenticated bits=0) by post.webmailer.de (8.13.1/8.13.1) with ESMTP id j82KZeN0016140 for ; Fri, 2 Sep 2005 22:35:41 +0200 (MEST) Message-Id: <200509022035.j82KZeN0016140@post.webmailer.de> From: "Matzwelt.info" To: Date: Fri, 2 Sep 2005 22:35:32 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcWv8P2AsPeD/PsCQYauX+QJO+qGmAACayZA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 In-Reply-To: <87hdd3gun8.fsf@penguin.cs.ucla.edu> X-Mailman-Approved-At: Fri, 02 Sep 2005 20:38:43 -0400 Subject: AW: df: Wrong Gigabyte-Output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 20:50:26 -0000 OK, what i have to do to get in 1 GB output und df -h. I test with = 1026MB (1.1 GB), 1018MB (1018MB), 996MB (996MB). Why i can=B4t get an output of = 1.0GB with these MB? sh-2.05b# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 1004M 472M 523M 48% / sh-2.05b# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 996M 472M 515M 48% / sh-2.05b# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 1018M 472M 536M 47% /=20 ########## Here are some more tests with the goal to make 1.0 GB Partition server:/# clear server:/# df -h Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 1018M 472M 536M 47% / tmpfs 504M 0 504M 0% /dev/shm /dev/hda1 54M 8,0M 45M 16% /boot /dev/hda5 958M 17M 893M 2% /mnt/1 /dev/hda6 1,1G 33M 943M 4% /mnt/2 /dev/hda7 942M 17M 879M 2% /mnt/3 /dev/hda8 1,1G 33M 958M 4% /mnt/4 /dev/hda9 912M 17M 849M 2% /mnt/5 /dev/hda10 857M 17M 798M 2% /mnt/6 server:/# df -m Dateisystem 1M-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt = auf /dev/hda3 1018 472 536 47% / tmpfs 504 0 504 0% /dev/shm /dev/hda1 54 8 45 16% /boot /dev/hda5 958 17 893 2% /mnt/1 /dev/hda6 1027 33 943 4% /mnt/2 /dev/hda7 942 17 879 2% /mnt/3 /dev/hda8 1043 33 958 4% /mnt/4 /dev/hda9 912 17 849 2% /mnt/5 /dev/hda10 857 17 798 2% /mnt/6 server:/# df -H Dateisystem Gr=F6=DFe Benut Verf Ben% Eingeh=E4ngt auf /dev/hda3 1,1G 495M 562M 47% / tmpfs 529M 0 529M 0% /dev/shm /dev/hda1 56M 8,4M 47M 16% /boot /dev/hda5 1,1G 17M 937M 2% /mnt/1 /dev/hda6 1,1G 34M 989M 4% /mnt/2 /dev/hda7 988M 17M 921M 2% /mnt/3 /dev/hda8 1,1G 34M 1,1G 4% /mnt/4 /dev/hda9 956M 17M 890M 2% /mnt/5 /dev/hda10 899M 17M 837M 2% /mnt/6 server:/# df Dateisystem 1K-Bl=F6cke Benutzt Verf=FCgbar Ben% Eingeh=E4ngt = auf /dev/hda3 1041744 482824 548320 47% / tmpfs 515716 0 515716 0% /dev/shm /dev/hda1 54416 8175 45680 16% /boot /dev/hda5 980308 16428 914084 2% /mnt/1 /dev/hda6 1051472 32828 965232 4% /mnt/2 /dev/hda7 964500 16428 899076 2% /mnt/3 /dev/hda8 1067288 32828 980244 4% /mnt/4 /dev/hda9 932880 16428 869064 2% /mnt/5 /dev/hda10 877544 16428 816540 2% /mnt/6 -----Urspr=FCngliche Nachricht----- Von: Paul Eggert [mailto:eggert@CS.UCLA.EDU]=20 Gesendet: Freitag, 2. September 2005 21:03 An: Matzwelt.info Cc: bug-coreutils@gnu.org Betreff: Re: df: Wrong Gigabyte-Output "Matzwelt.info" writes: > ich saw this Problem after Dist-Upgrade (aptitude) from Debian 3.0 = (woody) > to Debian 3.1 (sarge). 3304 MB must be output 3,2(265625) GB on df -h. I don't see a bug here. As I understand it, you had 3,463,516,160 bytes on your partition, which is about 3303.07 MiB (one MiB =3D=3D = 2**20 bytes). df always rounds up (POSIX requires this) so it rounds up the total to 3304 MiB-blocks. That same total is also equal to about 3.23 GiB (one GiB =3D=3D 2**30 bytes), so df -h's "3,3G" is also correctly rounded up. Also, df -H's "3,5G" is also correctly rounded up, since the actual value is about 3.46 GB. Does this explain what you observed? If not, please clarify. Thanks. From MAILER-DAEMON Sat Sep 03 03:59:54 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBSwJ-0002Jk-Fa for mharc-bug-coreutils@gnu.org; Sat, 03 Sep 2005 03:59:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBSva-0002Cl-MC for bug-coreutils@gnu.org; Sat, 03 Sep 2005 03:59:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBSvP-0002BQ-37 for bug-coreutils@gnu.org; Sat, 03 Sep 2005 03:58:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBSrw-0001dy-RX for bug-coreutils@gnu.org; Sat, 03 Sep 2005 03:55:21 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBSqK-0005gP-2K for bug-coreutils@gnu.org; Sat, 03 Sep 2005 03:53:40 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j837o4406804; Sat, 3 Sep 2005 00:50:04 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EBSmb-0004oT-CH; Sat, 03 Sep 2005 00:49:49 -0700 To: "Matzwelt.info" References: <200509022035.j82KZeN0016140@post.webmailer.de> From: Paul Eggert Date: Sat, 03 Sep 2005 00:49:49 -0700 In-Reply-To: <200509022035.j82KZeN0016140@post.webmailer.de> (Matzwelt info's message of "Fri, 2 Sep 2005 22:35:32 +0200") Message-ID: <87br3asi8y.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: AW: df: Wrong Gigabyte-Output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2005 07:59:46 -0000 "Matzwelt.info" writes: > OK, what i have to do to get in 1 GB output und df -h. I test with 1026MB > (1.1 GB), 1018MB (1018MB), 996MB (996MB). Why i can=C2=B4t get an output = of 1.0GB > with these MB? Why do you want it to say exactly "1.0G"? Is it a trivia contest or something? Anyway, to get "1.0G" with "df -h", I suspect you need a partition that has more than 1023 MiB, and not less than 1024 MiB. Not that I can guarantee this. From MAILER-DAEMON Sat Sep 03 06:54:17 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBVf5-0001Rr-J6 for mharc-bug-coreutils@gnu.org; Sat, 03 Sep 2005 06:54:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBVev-0001MN-BO for bug-coreutils@gnu.org; Sat, 03 Sep 2005 06:54:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBVen-0001IM-LX for bug-coreutils@gnu.org; Sat, 03 Sep 2005 06:53:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBVen-0001GP-1b for bug-coreutils@gnu.org; Sat, 03 Sep 2005 06:53:57 -0400 Received: from [61.95.133.150] (helo=students.iiit.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EBVbC-0007Md-VQ for bug-coreutils@gnu.org; Sat, 03 Sep 2005 06:50:16 -0400 Received: from students.iiit.net (localhost.localdomain [127.0.0.1]) by students.iiit.net (8.13.1/8.13.0) with ESMTP id j82K4Xcd005074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Sep 2005 01:34:33 +0530 Received: from localhost (vamsee_k@localhost) by students.iiit.net (8.13.1/8.12.8/Submit) with ESMTP id j82K4WBK005071; Sat, 3 Sep 2005 01:34:32 +0530 Date: Sat, 3 Sep 2005 01:34:32 +0530 (IST) From: "G. Vamsee Krishna" To: Ali Hamza In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-IIITH-MailScanner-Information: Please contact the IIIT Server Room (111) for more information X-IIITH-MailScanner: Found to be clean X-IIITH-MailScanner-From: vamsee_k@students.iiit.net Cc: bug-coreutils@gnu.org Subject: Re: Configure Problem X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2005 10:54:08 -0000 On Fri, 2 Sep 2005, Ali Hamza wrote: > I m building LFS Version 5.2.1. > In chapter six when i configured coreutils-5.2.1. > with > DEFAULT_POSIX2_VERSION=199209 ./configure --prefix =/usr > command i received the following error message > > configure: error: expected an absolute directory name for --prefix: =/usr > Ran this on my machine [vamsee@laetitia coreutils-5.2.1]$ DEFAULT_POSIX2_VERSION=199209 ./configure --prefix =/usr configure: error: expected an absolute directory name for --prefix: =/usr [vamsee@laetitia coreutils-5.2.1]$ DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/usr checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes So I guess you can't give that space in --prefix=/usr. The arguments are seperated by spaces. So you are not passing any value for --prefix. Vamsee From MAILER-DAEMON Sun Sep 04 16:01:27 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EC0gA-0005vL-Em for mharc-bug-coreutils@gnu.org; Sun, 04 Sep 2005 16:01:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EByeP-0005V4-IE for bug-coreutils@gnu.org; Sun, 04 Sep 2005 13:51:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EByeK-0005Sy-Eu for bug-coreutils@gnu.org; Sun, 04 Sep 2005 13:51:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EByeK-0005I6-2K for bug-coreutils@gnu.org; Sun, 04 Sep 2005 13:51:24 -0400 Received: from [64.81.245.74] (helo=ishtar.tlinx.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EByIV-0005t9-9m for bug-coreutils@gnu.org; Sun, 04 Sep 2005 13:28:51 -0400 Received: from [192.168.3.20] (shiva [192.168.3.20]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id j84HO75x018802 for ; Sun, 4 Sep 2005 10:24:07 -0700 Message-ID: <431B2DB8.7020600@tlinx.org> Date: Sun, 04 Sep 2005 10:24:08 -0700 From: "Linda A. Walsh" User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en, en_US MIME-Version: 1.0 To: bug-coreutils@gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sun, 04 Sep 2005 16:01:22 -0400 Subject: place for find bugs? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2005 17:51:30 -0000 Is find considered a "core util"? or where should I report a 'find' bug? I ran into something I'd consider a bug in find: was trying to clear out empty directories using the "-empty" predicate. It returns "true" in the case of a directory full of "symlinks" (at least on an xfs file system under SuSE 9.3, package findutils-4.2.19-3.1.). While there may be no file space allocated for files or directories under the directory, it seems there may very well be space taken up by symlinks themselves and even though they may be held within the minimum allocation unit of the directory block (4k, I believe), I don't regard that as "empty". It still is taking up 1 block by it's existance. ;-/ Should this go to another list? Thanks, Linda From MAILER-DAEMON Sun Sep 04 17:01:03 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EC1br-0004Se-9n for mharc-bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:01:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EC1ZF-0003PB-EX for bug-coreutils@gnu.org; Sun, 04 Sep 2005 16:58:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EC1Z5-0003JG-Un for bug-coreutils@gnu.org; Sun, 04 Sep 2005 16:58:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EC1Yx-00036m-RI for bug-coreutils@gnu.org; Sun, 04 Sep 2005 16:58:06 -0400 Received: from [80.68.81.132] (helo=bigben2.bytemark.co.uk) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EC1Fl-0007kq-Pj for bug-coreutils@gnu.org; Sun, 04 Sep 2005 16:38:14 -0400 Received: from [80.68.89.77] (helo=excession.spiral-arm.org) by bigben2.bytemark.co.uk with esmtp (Exim 4.52) id 1EC1C9-0003E1-Mj; Sun, 04 Sep 2005 20:34:29 +0000 Received: by excession.spiral-arm.org (Postfix, from userid 1000) id C1A188B6A; Sun, 4 Sep 2005 21:43:59 +0100 (BST) Date: Sun, 4 Sep 2005 21:43:59 +0100 To: "Linda A. Walsh" Message-ID: <20050904204359.GB11681@excession.spiral-arm.org> References: <431B2DB8.7020600@tlinx.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <431B2DB8.7020600@tlinx.org> User-Agent: Mutt/1.5.9i From: jay@excession.spiral-arm.org (James Youngman) Cc: bug-coreutils@gnu.org Subject: Re: place for find bugs? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2005 21:01:00 -0000 On Sun, Sep 04, 2005 at 10:24:08AM -0700, Linda A. Walsh wrote: > Should this go to another list? I've responded to . James. From MAILER-DAEMON Sun Sep 04 17:23:30 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EC1xa-0002Vu-BL for mharc-bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:23:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EC1xZ-0002VZ-2I for bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:23:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EC1wt-0002PL-Hv for bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:22:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EC1wr-0002AE-H4 for bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:22:45 -0400 Received: from [146.169.1.193] (helo=roadrunner.doc.ic.ac.uk) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EC1gV-0000z5-0X for bug-coreutils@gnu.org; Sun, 04 Sep 2005 17:05:51 -0400 Received: from medusa-s4.doc.ic.ac.uk ([146.169.10.15]) by roadrunner.doc.ic.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.43) id 1EC1cp-0004Sv-Jn; Sun, 04 Sep 2005 22:02:03 +0100 Date: Sun, 4 Sep 2005 22:02:03 +0100 (BST) From: Philip Rowlands To: "Linda A. Walsh" In-Reply-To: <431B2DB8.7020600@tlinx.org> Message-ID: References: <431B2DB8.7020600@tlinx.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: bug-coreutils@gnu.org Subject: Re: place for find bugs? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2005 21:23:29 -0000 On Sun, 4 Sep 2005, Linda A. Walsh wrote: >Is find considered a "core util"? or where should I report a 'find' bug? GNU find is not a coreutil. My local version suggests: Report (and track progress on fixing) bugs via the findutils bug-reporting page at http://savannah.gnu.org/ or, if you have no web access, by sending email to . >was trying to clear out empty directories using the "-empty" predicate. >It returns "true" in the case of a directory full of "symlinks" FWIW, I can't reproduce this problem on ext3 with find version 4.2.20 (possibly with Fedora patches). Cheers, Phil From MAILER-DAEMON Mon Sep 05 13:21:41 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECKf4-0005SU-HW for mharc-bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:21:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECKez-0005Q4-MW for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:21:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECKex-0005P5-KH for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:21:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECKex-0005Kb-31 for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:21:31 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECKV0-0003W2-IY for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:11:14 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 86D0A389B; Mon, 5 Sep 2005 19:07:18 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Date: Mon, 05 Sep 2005 19:07:18 +0200 Message-ID: <878xyb1m0p.fsf@rho.meyering.net> Lines: 59 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: verify.h: don't accept non-constant expressions X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2005 17:21:36 -0000 I realized that verify and verify_expr would mistakenly accept an invalid (non-constant) expression when compiled with gcc and when the offending expression is within a function. For example, without the change below, the following erroneous usage would go undetected (i.e., would be successfully compiled) by gcc: #include "verify.h" static void foo (int n) { verify (n); } With the fixed macros, gcc gives a compile-time diagnostic, as we would expect: $ gcc -c verify-test.c verify-test.c: In function 'foo': verify-test.c:2: error: size of array 'verify_error_if_non_const__' is negative I've applied this patch: 2005-09-05 Jim Meyering * verify.h (__builtin_constant_p) [__GNUC__ <= 2]: Define to 1. (verify_type__) [verify_error_if_non_const__]: New member/test, to help detect when verify or verify_expr is mistakenly passed a non-constant argument within a function. Index: lib/verify.h =================================================================== RCS file: /fetish/cu/lib/verify.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -u -r1.5 -r1.6 --- lib/verify.h 11 Jul 2005 23:28:09 -0000 1.5 +++ lib/verify.h 5 Sep 2005 16:57:40 -0000 1.6 @@ -24,13 +24,23 @@ # define GL_CONCAT0(x, y) x##y # define GL_CONCAT(x, y) GL_CONCAT0 (x, y) +/* If gcc predates 3.0, then disable the check below to ensure + that verify_type__'s argument is a constant expression. */ +# if __GNUC__ <= 2 +# defined __builtin_constant_p(R) 1 +# endif + /* A type that is valid if and only if R is nonzero. R should be an integer constant expression. verify_type__ and verify_error_if_negative_size__ are symbols that are private to this header file. */ # define verify_type__(R) \ - struct { int verify_error_if_negative_size__[(R) ? 1 : -1]; } + struct { \ + /* Provoke a compile-time failure if R is a non-constant expression. */ \ + int verify_error_if_non_const__[__builtin_constant_p (R) ? 1 : -1]; \ + /* Provoke a compile-time failure if R is nonzero. */ \ + int verify_error_if_negative_size__[(R) ? 1 : -1]; } /* Verify requirement R at compile-time, as a declaration. R should be an integer constant expression. From MAILER-DAEMON Mon Sep 05 13:56:21 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECLCf-0001pN-Kt for mharc-bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:56:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECLCd-0001ns-Qm for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:56:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECL91-0000kC-FE for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:52:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECL8x-0000aT-K8 for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:52:31 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECKos-00055Q-Jv for bug-coreutils@gnu.org; Mon, 05 Sep 2005 13:31:47 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 7233F389B; Mon, 5 Sep 2005 19:27:50 +0200 (CEST) From: Jim Meyering To: Mike Frysinger In-Reply-To: <200508312147.47226.vapier@gentoo.org> (Mike Frysinger's message of "Wed, 31 Aug 2005 21:47:47 -0400") References: <200508301951.55030.vapier@gentoo.org> <87d5nufwoh.fsf@rho.meyering.net> <200508312147.47226.vapier@gentoo.org> Date: Mon, 05 Sep 2005 19:27:50 +0200 Message-ID: <873boj1l2h.fsf@rho.meyering.net> Lines: 181 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: colorize more file types with dircolors ? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2005 17:56:20 -0000 Mike Frysinger wrote: ... > done, find attached ... thanks for all the pointers Thanks for doing that. I've changed an expression and a couple of symbol names in ls.c to make them more readable and added proper ChangeLog entries and a test case: 2005-09-05 Jim Meyering Colorize set-user-ID and set-group-ID files and sticky, other-writable, and sticky-and-other-writable directories. * src/dircolors.c (slack_codes): Add new dircolors mode names. (ls_codes): Add corresponding two-letter ls mode strings. * src/ls.c (indicator_no[]): Add new symbols. (indicator_name[]): Add corresponding mode strings. (color_indicator[]): Add an entry for each new mode string. (print_color_indicator): Honor new types. * src/dircolors.hin: Document the default colors for the new strings. From Mike Frysinger, based on a patch from Fedora. * tests/ls-2/tests (setuid-etc): New test, for the above. Index: src/dircolors.c =================================================================== RCS file: /fetish/cu/src/dircolors.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -p -u -r1.90 -r1.91 --- src/dircolors.c 12 Aug 2005 08:06:28 -0000 1.90 +++ src/dircolors.c 5 Sep 2005 17:11:15 -0000 1.91 @@ -67,13 +67,15 @@ static const char *const slack_codes[] = "NORMAL", "NORM", "FILE", "DIR", "LNK", "LINK", "SYMLINK", "ORPHAN", "MISSING", "FIFO", "PIPE", "SOCK", "BLK", "BLOCK", "CHR", "CHAR", "DOOR", "EXEC", "LEFT", "LEFTCODE", "RIGHT", "RIGHTCODE", - "END", "ENDCODE", NULL + "END", "ENDCODE", "SUID", "SETUID", "SGID", "SETGID", "STICKY", + "OTHER_WRITABLE", "OWR", "STICKY_OTHER_WRITABLE", "OWT", NULL }; static const char *const ls_codes[] = { "no", "no", "fi", "di", "ln", "ln", "ln", "or", "mi", "pi", "pi", "so", "bd", "bd", "cd", "cd", "do", "ex", "lc", "lc", "rc", "rc", "ec", "ec" + "su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", NULL }; static struct option const long_options[] = Index: src/dircolors.hin =================================================================== RCS file: /fetish/cu/src/dircolors.hin,v retrieving revision 1.19 retrieving revision 1.20 diff -u -p -u -r1.19 -r1.20 --- src/dircolors.hin 26 Mar 2005 06:56:01 -0000 1.19 +++ src/dircolors.hin 5 Sep 2005 17:11:39 -0000 1.20 @@ -51,6 +51,11 @@ DOOR 01;35 # door BLK 40;33;01 # block device driver CHR 40;33;01 # character device driver ORPHAN 40;31;01 # symlink to nonexistent file +SETUID 37;41 # file that is setuid (u+s) +SETGID 30;43 # file that is setgid (g+s) +STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) +OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky +STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable # This is for files with execute permission: EXEC 01;32 Index: src/ls.c =================================================================== RCS file: /fetish/cu/src/ls.c,v retrieving revision 1.397 retrieving revision 1.398 diff -u -p -u -r1.397 -r1.398 --- src/ls.c 14 Aug 2005 08:30:25 -0000 1.397 +++ src/ls.c 5 Sep 2005 17:12:07 -0000 1.398 @@ -518,13 +518,15 @@ enum Dereference_symlink enum indicator_no { C_LEFT, C_RIGHT, C_END, C_NORM, C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK, - C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR + C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID, + C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE }; static const char *const indicator_name[]= { "lc", "rc", "ec", "no", "fi", "di", "ln", "pi", "so", - "bd", "cd", "mi", "or", "ex", "do", NULL + "bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st", + "ow", "tw", NULL }; struct color_ext_type @@ -550,7 +552,12 @@ static struct bin_str color_indicator[] { 0, NULL }, /* mi: Missing file: undefined */ { 0, NULL }, /* or: Orphaned symlink: undefined */ { LEN_STR_PAIR ("01;32") }, /* ex: Executable: bright green */ - { LEN_STR_PAIR ("01;35") } /* do: Door: bright magenta */ + { LEN_STR_PAIR ("01;35") }, /* do: Door: bright magenta */ + { LEN_STR_PAIR ("37;41") }, /* su: setuid: white on red */ + { LEN_STR_PAIR ("30;43") }, /* sg: setgid: black on yellow */ + { LEN_STR_PAIR ("37;44") }, /* st: sticky: black on blue */ + { LEN_STR_PAIR ("34;42") }, /* ow: other-writable: blue on green */ + { LEN_STR_PAIR ("30;42") }, /* tw: ow w/ sticky: black on green */ }; /* FIXME: comment */ @@ -3687,7 +3694,16 @@ print_color_indicator (const char *name, else { if (S_ISDIR (mode)) - type = C_DIR; + { + if ((mode & S_ISVTX) && (mode & S_IWOTH)) + type = C_STICKY_OTHER_WRITABLE; + else if ((mode & S_IWOTH) != 0) + type = C_OTHER_WRITABLE; + else if ((mode & S_ISVTX) != 0) + type = C_STICKY; + else + type = C_DIR; + } else if (S_ISLNK (mode)) type = ((!linkok && color_indicator[C_ORPHAN].string) ? C_ORPHAN : C_LINK); @@ -3702,8 +3718,15 @@ print_color_indicator (const char *name, else if (S_ISDOOR (mode)) type = C_DOOR; - if (type == C_FILE && (mode & S_IXUGO) != 0) - type = C_EXEC; + if (type == C_FILE) + { + if ((mode & S_ISUID) != 0) + type = C_SETUID; + else if ((mode & S_ISGID) != 0) + type = C_SETGID; + else if ((mode & S_IXUGO) != 0) + type = C_EXEC; + } /* Check the file's suffix only if still classified as C_FILE. */ ext = NULL; Index: tests/ls-2/tests =================================================================== RCS file: /fetish/cu/tests/ls-2/tests,v retrieving revision 1.22 retrieving revision 1.23 diff -u -p -u -r1.22 -r1.23 --- tests/ls-2/tests 10 May 2005 06:59:24 -0000 1.22 +++ tests/ls-2/tests 5 Sep 2005 17:13:09 -0000 1.23 @@ -97,6 +97,27 @@ my @Tests = $mkdir, $rmdir, {EXIT => 2}], ['recursive-2', '-R d', {OUT => "d:\ne\n\nd/e:\n"}, $mkdir2, $rmdir2], + + ['setuid-etc', '-1 -d --color=always owr owt setgid setuid sticky', + {OUT => + "\e[0m\e[34;42mowr\e[0m\n" + . "\e[30;42mowt\e[0m\n" + . "\e[30;43msetgid\e[0m\n" + . "\e[37;41msetuid\e[0m\n" + . "\e[37;44msticky\e[0m\n" + . "\e[m" + }, + {PRE => sub { + system + "touch setuid && chmod u+s setuid;" + ."touch setgid && chmod g+s setgid;" + ."mkdir sticky && chmod +t sticky;" + ."mkdir owt && chmod +t,o+w owt;" + ."mkdir owr && chmod o+w owr" }}, + {POST => sub { + unlink qw(setuid setgid); + foreach my $dir (qw(owr owt sticky)) {rmdir $dir} }}, + ], ); my $save_temps = $ENV{SAVE_TEMPS}; From MAILER-DAEMON Tue Sep 06 04:36:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECYsW-0007b8-DV for mharc-bug-coreutils@gnu.org; Tue, 06 Sep 2005 04:32:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECYsO-0007aK-Lo for bug-coreutils@gnu.org; Tue, 06 Sep 2005 04:32:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECYpl-0007O7-2R for bug-coreutils@gnu.org; Tue, 06 Sep 2005 04:31:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECYpK-0006tW-CA for bug-coreutils@gnu.org; Tue, 06 Sep 2005 04:29:11 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECYoj-0000u3-Cu for bug-coreutils@gnu.org; Tue, 06 Sep 2005 04:28:33 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j868OS419262 for ; Tue, 6 Sep 2005 01:24:28 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ECYkW-0005EB-RZ for bug-coreutils@gnu.org; Tue, 06 Sep 2005 01:24:12 -0700 To: bug-coreutils@gnu.org References: <878xyb1m0p.fsf@rho.meyering.net> From: Paul Eggert Date: Tue, 06 Sep 2005 01:24:12 -0700 In-Reply-To: <878xyb1m0p.fsf@rho.meyering.net> (Jim Meyering's message of "Mon, 05 Sep 2005 19:07:18 +0200") Message-ID: <87psrmy577.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: verify.h: don't accept non-constant expressions X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 08:32:24 -0000 Jim Meyering writes: > +# if __GNUC__ <= 2 > +# defined __builtin_constant_p(R) 1 > +# endif Hmm, "defined"? While looking into this, I found an alternate approach that should work with all ANSI C compilers, rather than relying on a special feature of GCC. I installed this patch instead: 2005-09-06 Paul Eggert * verify.h (verify_type__): Solve the problem by using a bit-field rather than an array. Index: verify.h =================================================================== RCS file: /fetish/cu/lib/verify.h,v retrieving revision 1.5 retrieving revision 1.7 diff -p -u -r1.5 -r1.7 --- verify.h 11 Jul 2005 23:28:09 -0000 1.5 +++ verify.h 6 Sep 2005 08:20:56 -0000 1.7 @@ -30,7 +30,7 @@ are private to this header file. */ # define verify_type__(R) \ - struct { int verify_error_if_negative_size__[(R) ? 1 : -1]; } + struct { int verify_error_if_negative_size__ : (R) ? 1 : -1; } /* Verify requirement R at compile-time, as a declaration. R should be an integer constant expression. From MAILER-DAEMON Tue Sep 06 07:23:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECbY0-0005nT-Fx for mharc-bug-coreutils@gnu.org; Tue, 06 Sep 2005 07:23:28 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECbXx-0005mR-1H for bug-coreutils@gnu.org; Tue, 06 Sep 2005 07:23:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECbXu-0005l3-1Q for bug-coreutils@gnu.org; Tue, 06 Sep 2005 07:23:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECbXs-0005dw-VF for bug-coreutils@gnu.org; Tue, 06 Sep 2005 07:23:21 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECbRb-0005xc-Fx for bug-coreutils@gnu.org; Tue, 06 Sep 2005 07:16:51 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id E644E1AE; Tue, 6 Sep 2005 13:12:44 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87psrmy577.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Tue, 06 Sep 2005 01:24:12 -0700") References: <878xyb1m0p.fsf@rho.meyering.net> <87psrmy577.fsf@penguin.cs.ucla.edu> Date: Tue, 06 Sep 2005 13:12:44 +0200 Message-ID: <87wtluzbyr.fsf@rho.meyering.net> Lines: 22 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: verify.h: don't accept non-constant expressions X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 11:23:27 -0000 Paul Eggert wrote: > Jim Meyering writes: > >> +# if __GNUC__ <= 2 >> +# defined __builtin_constant_p(R) 1 >> +# endif > > Hmm, "defined"? Indeed :) > While looking into this, I found an alternate approach that should > work with all ANSI C compilers, rather than relying on a special > feature of GCC. I installed this patch instead: > > 2005-09-06 Paul Eggert > > * verify.h (verify_type__): Solve the problem by using a bit-field > rather than an array. Good idea. I prefer that, too. Thanks. From MAILER-DAEMON Tue Sep 06 10:48:17 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECekC-0007zg-RX for mharc-bug-coreutils@gnu.org; Tue, 06 Sep 2005 10:48:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECeR3-0001Do-3h for bug-coreutils@gnu.org; Tue, 06 Sep 2005 10:28:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECeR1-0001DB-EX for bug-coreutils@gnu.org; Tue, 06 Sep 2005 10:28:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECePK-0000YV-Qu for bug-coreutils@gnu.org; Tue, 06 Sep 2005 10:26:42 -0400 Received: from [128.183.165.144] (helo=daacmail.gsfc.nasa.gov) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ECdzP-0003VH-DT for bug-coreutils@gnu.org; Tue, 06 Sep 2005 09:59:55 -0400 Received: from daacmail.gsfc.nasa.gov (localhost [127.0.0.1]) by daacmail.gsfc.nasa.gov with ESMTP id j86DtkIR016950 for ; Tue, 6 Sep 2005 09:55:46 -0400 Received: (from root@localhost) by daacmail.gsfc.nasa.gov (Submit) id j86DtkFA016949; Tue, 6 Sep 2005 09:55:46 -0400 From: root Message-Id: <200509061355.j86DtkFA016949@daacmail.gsfc.nasa.gov> To: bug-coreutils@gnu.org Date: Tue, 6 Sep 2005 09:55:46 -0400 (EDT) X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 06 Sep 2005 10:48:16 -0400 Subject: sum manpage in coreutils-5.2.1-48.1 minor fixups X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 14:28:29 -0000 the info page is right, but might as well fix up the man page since it is so short and it had us confused: -r defeat -s, use BSD sum algorithm, use 1K blocks -s, --sysv use System V sum algorithm, use 512 bytes blocks would be clearer if it just said: -r use BSD sum algorithm, use 1K blocks (the default) -s, --sysv use System V sum algorithm, use 512 bytes blocks ^---- might as well remove this "s" or just use the exact same verbage as info page: By default, GNU `sum' computes checksums using an algorithm compatible with BSD `sum' and prints file sizes in units of 1024-byte blocks. The program accepts the following options. Also see *Note Common options::. `-r' Use the default (BSD compatible) algorithm. This option is included for compatibility with the System V `sum'. Unless `-s' was also given, it has no effect. `-s' `--sysv' Compute checksums using an algorithm compatible with System V `sum''s default, and print file sizes in units of 512-byte blocks. From MAILER-DAEMON Tue Sep 06 17:35:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ECl6R-0006wi-CQ for mharc-bug-coreutils@gnu.org; Tue, 06 Sep 2005 17:35:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECl6Q-0006wK-Dw for bug-coreutils@gnu.org; Tue, 06 Sep 2005 17:35:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECl6P-0006w4-Gz for bug-coreutils@gnu.org; Tue, 06 Sep 2005 17:35:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECl1S-00056V-OC for bug-coreutils@gnu.org; Tue, 06 Sep 2005 17:30:30 -0400 Received: from [204.74.68.40] (helo=frodo.hserus.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ECkYK-00064X-PX for bug-coreutils@gnu.org; Tue, 06 Sep 2005 17:00:25 -0400 Received: from tc218-187-24-146.dialup.dynamic.apol.com.tw ([218.187.24.146]:3771 helo=jidanni1) by frodo.hserus.net with esmtpsa (Cipher TLSv1:AES256-SHA:256) (Exim 4.52 #0) id 1ECkTt-000MlB-FK by authid with plain for ; Wed, 07 Sep 2005 02:26:02 +0530 From: Dan Jacobson To: bug-coreutils@gnu.org Date: Wed, 07 Sep 2005 04:20:18 +0800 Message-ID: <87d5nmkkxp.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: fold -s: add option for variable spaces at beginning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 21:35:38 -0000 In case fold -s hasn't been enhanced since 5.2.1: Unhappy with wasted spaces at the end of each line, and no variable choice of how many spaces at the beginning of each continuation line, $ tr \\n ' ' Message-ID: <20050907155055.GA9290@dementia.proulx.com> Mail-Followup-To: Greg Aloe , bug-coreutils@gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: cp -p error when directory security is modified from Windows X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2005 15:59:29 -0000 Greg Aloe wrote: > The strace commands seem to confirm what we already suspected. If you > look at the output differences, the call to chown was permitted *after* > I mucked around on the Windows side. This causes a subsequent > "operation not permitted" error when chmod is called. Then it does seem to be something deep down in the MS filesystem layer. > Do you know of any other APIs I can use to probe the file attributes > that allow/deny changing ownership? Nope. Since you now know this is related to something specific and deep down in the MS system the best thing to do is to take this information to a mailing list that works with MS systems. I would suggest the cygwin mailing list. http://cygwin.com http://cygwin.com/lists.html Bob From MAILER-DAEMON Thu Sep 08 03:18:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDGgO-0005rS-L3 for mharc-bug-coreutils@gnu.org; Thu, 08 Sep 2005 03:18:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDGgL-0005qi-Oq for bug-coreutils@gnu.org; Thu, 08 Sep 2005 03:18:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDGfX-0005hi-8L for bug-coreutils@gnu.org; Thu, 08 Sep 2005 03:18:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDGfV-0005UI-PX for bug-coreutils@gnu.org; Thu, 08 Sep 2005 03:17:57 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDGQ3-0006Mp-GF for bug-coreutils@gnu.org; Thu, 08 Sep 2005 03:01:59 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j886vR411281 for ; Wed, 7 Sep 2005 23:57:27 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDGLf-0001gJ-CC for bug-coreutils@gnu.org; Wed, 07 Sep 2005 23:57:27 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 07 Sep 2005 23:57:27 -0700 Message-ID: <87ll282giw.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: documentation and diagnostic fixes for "nice" and "nice values" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 07:18:51 -0000 I noticed that the coreutils documention and usage strings for "nice" referred to "nice values" in the range of (say) -20 to 19. But POSIX says that nice values are nonnegative. I thought the simplest fix was to use the word "niceness" to refer to a value in the range -20 to 19, so that we don't contradict POSIX. That way, we don't have to mention "nice values" at all. I installed this: 2005-09-07 Paul Eggert Use the phrase "niceness" instead of "nice value" to describe the biased nice value that can go negative. This corrects a discrepancy with POSIX, which states that nice values are nonnegative. * src/nice.c (GET_NICENESS): Renamed from GET_NICE_VALUE. All uses changed. (usage): Say "niceness" rather than "nice value". (main): Say "niceness" rather than "priority" (which is something else entirely nowadays). * doc/coreutils.texi (nice invocation): Use "niceness", not "nice value" to talk about nice values offset by -20. Don't use the word "priority" when niceness is intended. Index: src/nice.c =================================================================== RCS file: /fetish/cu/src/nice.c,v retrieving revision 1.83 diff -p -u -r1.83 nice.c --- src/nice.c 16 Jun 2005 21:36:48 -0000 1.83 +++ src/nice.c 8 Sep 2005 05:25:58 -0000 @@ -1,4 +1,4 @@ -/* nice -- run a program with modified scheduling priority +/* nice -- run a program with modified nice value Copyright (C) 1990-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -44,9 +44,9 @@ #define AUTHORS "David MacKenzie" #ifdef NICE_PRIORITY -# define GET_NICE_VALUE() nice (0) +# define GET_NICENESS() nice (0) #else -# define GET_NICE_VALUE() getpriority (PRIO_PROCESS, 0) +# define GET_NICENESS() getpriority (PRIO_PROCESS, 0) #endif #ifndef NZERO @@ -78,11 +78,11 @@ usage (int status) { printf (_("Usage: %s [OPTION] [COMMAND [ARG]...]\n"), program_name); printf (_("\ -Run COMMAND with an adjusted nice value, which affects the scheduling priority.\n\ -With no COMMAND, print the current nice value. Nice values range from\n\ +Run COMMAND with an adjusted niceness, which affects process scheduling.\n\ +With no COMMAND, print the current niceness. Nicenesses range from\n\ %d (most favorable scheduling) to %d (least favorable).\n\ \n\ - -n, --adjustment=N add integer N to the nice value (default 10)\n\ + -n, --adjustment=N add integer N to the niceness (default 10)\n\ "), - NZERO, NZERO - 1); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -96,7 +96,7 @@ With no COMMAND, print the current nice int main (int argc, char **argv) { - int current_nice_value; + int current_niceness; int adjustment = 10; char const *adjustment_given = NULL; bool ok; @@ -169,25 +169,25 @@ main (int argc, char **argv) } /* No command given; print the nice value. */ errno = 0; - current_nice_value = GET_NICE_VALUE (); - if (current_nice_value == -1 && errno != 0) - error (EXIT_FAIL, errno, _("cannot get priority")); - printf ("%d\n", current_nice_value); + current_niceness = GET_NICENESS (); + if (current_niceness == -1 && errno != 0) + error (EXIT_FAIL, errno, _("cannot get niceness")); + printf ("%d\n", current_niceness); exit (EXIT_SUCCESS); } #ifndef NICE_PRIORITY errno = 0; - current_nice_value = GET_NICE_VALUE (); - if (current_nice_value == -1 && errno != 0) - error (EXIT_FAIL, errno, _("cannot get priority")); - ok = (setpriority (PRIO_PROCESS, 0, current_nice_value + adjustment) == 0); + current_niceness = GET_NICENESS (); + if (current_niceness == -1 && errno != 0) + error (EXIT_FAIL, errno, _("cannot get niceness")); + ok = (setpriority (PRIO_PROCESS, 0, current_niceness + adjustment) == 0); #else errno = 0; ok = (nice (adjustment) != -1 || errno == 0); #endif if (!ok) - error (errno == EPERM ? 0 : EXIT_FAIL, errno, _("cannot set priority")); + error (errno == EPERM ? 0 : EXIT_FAIL, errno, _("cannot set niceness")); execvp (argv[i], &argv[i]); Index: doc/coreutils.texi =================================================================== RCS file: /fetish/cu/doc/coreutils.texi,v retrieving revision 1.276 diff -p -u -r1.276 coreutils.texi --- doc/coreutils.texi.~1.276.~ 2005-08-15 01:41:21.000000000 -0700 +++ doc/coreutils.texi 2005-09-07 22:34:10.000000000 -0700 @@ -79,7 +79,7 @@ * mkfifo: (coreutils)mkfifo invocation. Create FIFOs (named pipes). * mknod: (coreutils)mknod invocation. Create special files. * mv: (coreutils)mv invocation. Rename files. -* nice: (coreutils)nice invocation. Modify scheduling priority. +* nice: (coreutils)nice invocation. Modify niceness. * nl: (coreutils)nl invocation. Number lines and write files. * nohup: (coreutils)nohup invocation. Immunize to hangups. * od: (coreutils)od invocation. Dump files in octal, etc. @@ -407,7 +407,7 @@ Modified command invocation * chroot invocation:: Run a command with a different root directory * env invocation:: Run a command in a modified environment -* nice invocation:: Run a command with modified scheduling priority +* nice invocation:: Run a command with modified niceness * nohup invocation:: Run a command immune to hangups * su invocation:: Run a command with substitute user and group ID @@ -12339,7 +12339,7 @@ user, etc. @menu * chroot invocation:: Modify the root directory. * env invocation:: Modify environment variables. -* nice invocation:: Modify scheduling priority. +* nice invocation:: Modify niceness. * nohup invocation:: Immunize to hangups. * su invocation:: Modify user and group ID. @end menu @@ -12491,32 +12491,29 @@ the exit status of @var{command} otherwi @node nice invocation -@section @command{nice}: Run a command with modified scheduling priority +@section @command{nice}: Run a command with modified niceness @pindex nice -@cindex nice value -@cindex modifying scheduling priority -@cindex scheduling priority, modifying -@cindex priority, modifying +@cindex niceness +@cindex scheduling, affecting @cindex appropriate privileges -@command{nice} prints or modifies a process's @dfn{nice value}, -a parameter that affects the process's scheduling priority. +@command{nice} prints or modifies a process's @dfn{niceness}, +a parameter that affects whether the process is scheduled favorably. Synopsis: @example nice [@var{option}]@dots{} [@var{command} [@var{arg}]@dots{}] @end example -If no arguments are given, @command{nice} prints the current nice -value, which it inherited. Otherwise, @command{nice} runs the given -@var{command} with its nice value adjusted. By default, its nice -value is incremented by 10. +If no arguments are given, @command{nice} prints the current niceness. +Otherwise, @command{nice} runs the given @var{command} with its +niceness adjusted. By default, its niceness is incremented by 10. -Nice values range at least from @minus{}20 (resulting in the most +Nicenesses range at least from @minus{}20 (resulting in the most favorable scheduling) through 19 (the least favorable). Some systems -may have a wider range of nice values; conversely, other systems may -enforce more restrictive limits. An attempt to set the nice value +may have a wider range of nicenesses; conversely, other systems may +enforce more restrictive limits. An attempt to set the niceness outside the supported range is treated as an attempt to use the minimum or maximum supported value. @@ -12537,7 +12534,7 @@ Options must precede operands. @itemx --adjustment=@var{adjustment} @opindex -n @opindex --adjustment -Add @var{adjustment} instead of 10 to the command's nice value. If +Add @var{adjustment} instead of 10 to the command's niceness. If @var{adjustment} is negative and you lack appropriate privileges, @command{nice} issues a warning but otherwise acts as if you specified a zero adjustment. @@ -12552,23 +12549,23 @@ option syntax @option{-@var{adjustment}} Exit status: @display -0 if no @var{command} is specified and the current priority is output +0 if no @var{command} is specified and the niceness is output 1 if @command{nice} itself fails 126 if @var{command} is found but cannot be invoked 127 if @var{command} cannot be found the exit status of @var{command} otherwise @end display -It is sometimes useful to run non-interactive programs with reduced priority. +It is sometimes useful to run a non-interactive program with reduced niceness. @example $ nice factor 4611686018427387903 @end example -Since @command{nice} prints the current priority, +Since @command{nice} prints the current niceness, you can invoke it through itself to demonstrate how it works. -The default behavior is to increase the nice value by @samp{10}: +The default behavior is to increase the niceness by @samp{10}: @example $ nice @@ -12579,17 +12576,17 @@ $ nice -n 10 nice 10 @end example -The @var{adjustment} is relative to the current nice value. In the +The @var{adjustment} is relative to the current niceness. In the next example, the first @command{nice} invocation runs the second one -with nice value 10, and it in turn runs the final one with a nice -value that is 3 more: +with niceness 10, and it in turn runs the final one with a niceness +that is 3 more: @example $ nice nice -n 3 nice 13 @end example -Specifying a nice value larger than the supported range +Specifying a niceness larger than the supported range is the same as specifying the maximum supported value: @example @@ -12597,11 +12594,11 @@ $ nice -n 10000000000 nice 19 @end example -Only a privileged user may run a process with higher priority: +Only a privileged user may run a process with lower niceness: @example $ nice -n -1 nice -nice: cannot set priority: Permission denied +nice: cannot set niceness: Permission denied 0 $ sudo nice -n -1 nice -1 @@ -12646,8 +12643,8 @@ descriptor as the (possibly-redirected) @command{nohup} does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line -with an @samp{&}. Also, @command{nohup} does not change the -scheduling priority of @var{command}; use @command{nice} for that, +with an @samp{&}. Also, @command{nohup} does not alter the +niceness of @var{command}; use @command{nice} for that, e.g., @samp{nohup nice @var{command}}. @var{command} must not be a special built-in utility (@pxref{Special From MAILER-DAEMON Thu Sep 08 09:36:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDMZS-000163-LD for mharc-bug-coreutils@gnu.org; Thu, 08 Sep 2005 09:36:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDMZQ-000140-GT for bug-coreutils@gnu.org; Thu, 08 Sep 2005 09:36:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDMZM-00011e-TW for bug-coreutils@gnu.org; Thu, 08 Sep 2005 09:36:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDMOY-0005gH-TR for bug-coreutils@gnu.org; Thu, 08 Sep 2005 09:24:51 -0400 Received: from [216.148.227.89] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDMBD-00074q-BK for bug-coreutils@gnu.org; Thu, 08 Sep 2005 09:11:03 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (rwcrmhc14) with ESMTP id <2005090813062701400fc2h1e>; Thu, 8 Sep 2005 13:06:27 +0000 Message-ID: <43203755.4030800@byu.net> Date: Thu, 08 Sep 2005 07:06:29 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bug-coreutils@gnu.org X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: dircolors and default shell X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 13:36:05 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Right now, if SHELL is not exported, and dircolors was not given a shell option, it refuses to output anything: dircolors: no SHELL environment variable, and no shell type option given Would it make more sense if dircolors tried to do a bit more sleuthing before giving up, such as trying getpwuid(getuid())->pw_shell, or examining files in /proc to reverse-engineer if the parent process of dircolors is a shell on systems that support procfs? Or is this too likely to be fraught with portability problems and potential wrong choices? One reason I ask is that by default, bash ensures that SHELL exists (either inherited from the environment, or populated as a shell variable), but does not put SHELL into the environment when populating the shell variable. So it can be rather confusing that 'echo $SHELL' prints something (the shell variable), but dircolors fails without -b because SHELL was not exported to the environment. - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDIDdV84KuGfSFAYARAsSsAJwJrzNLQ1XS02VFf0EcgH/nbd46UwCePMx4 VMg67tllleK+gBE0nzIJ1Tc= =/X7h -----END PGP SIGNATURE----- From MAILER-DAEMON Thu Sep 08 13:57:42 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDQec-0001pM-RD for mharc-bug-coreutils@gnu.org; Thu, 08 Sep 2005 13:57:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDPYe-0005ku-Ky for bug-coreutils@gnu.org; Thu, 08 Sep 2005 12:47:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDPYV-0005he-WB for bug-coreutils@gnu.org; Thu, 08 Sep 2005 12:47:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDPYU-0005Vc-PP for bug-coreutils@gnu.org; Thu, 08 Sep 2005 12:47:18 -0400 Received: from [213.223.64.167] (helo=gsp3.sfr.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDPQh-0007jl-L1 for bug-coreutils@gnu.org; Thu, 08 Sep 2005 12:39:15 -0400 Received: from sfr.fr (127.0.0.1) by gsp3.sfr.fr (NPlex 6.0.021C4.14) id 42425E97000C71C1 for bug-coreutils@gnu.org; Thu, 8 Sep 2005 18:34:35 +0200 Date: Thu, 08 Sep 2005 18:34:35 +0200 Message-Id: MIME-Version: 1.0 Message-Context: text-message Content-Type: text/plain;charset="iso8859-1" Content-Transfer-Encoding: quoted-printable From: sd@sfr.fr To: bug-coreutils@gnu.org X-Mailman-Approved-At: Thu, 08 Sep 2005 13:57:40 -0400 Subject: join fails on numerically sorted key fields? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 16:51:38 -0000 Greetings, After much hair-pulling I have discovered what seems to m= e bizarre (or at least anti-intuitive) behavior of join: apparently, nume= rically sorted keys cause join to fail, silently. Given two files: = file1.txt: 50 100 200 300 file2.txt: 90 100 200 300 join fi= le1.txt file2.txt yields no result (!) Whereas: file3.txt: 10= 0 200 300 50 file4.txt: 100 200 300 90 join file3.txt file4.= txt yields: 100 200 300 Unless I'm missing something (environm= ent variables?), it appears that numerically sorted keys are ignored by j= oin. I am running join (textutils) 2.0 under Mac OSX 10.3.9 and join (= textutils) 2.0.21 under cygwin. This appears to be the same problem di= scussed by Jorge Infante on 11 August. It would be quite helpful for m= e if if I could use join with numerically sorted key fields, without havi= ng to alpha sort the files on the key fields, perform join, then numerica= lly resort the files on the key fields Many thanks if any ideas! = Sean DALY sd.not_this_bit@sfr.fr From MAILER-DAEMON Thu Sep 08 15:48:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDSO7-0008PP-GL for mharc-bug-coreutils@gnu.org; Thu, 08 Sep 2005 15:48:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDSO5-0008Ou-Vz for bug-coreutils@gnu.org; Thu, 08 Sep 2005 15:48:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDSMY-0007xV-Tp for bug-coreutils@gnu.org; Thu, 08 Sep 2005 15:47:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDSMU-0007jg-NV for bug-coreutils@gnu.org; Thu, 08 Sep 2005 15:47:06 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDSCQ-0006Wc-Fj for bug-coreutils@gnu.org; Thu, 08 Sep 2005 15:36:42 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j88JW1422558; Thu, 8 Sep 2005 12:32:01 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDS7t-0007qj-6R; Thu, 08 Sep 2005 12:32:01 -0700 To: sd@sfr.fr References: From: Paul Eggert Date: Thu, 08 Sep 2005 12:32:01 -0700 In-Reply-To: (sd@sfr.fr's message of "Thu, 08 Sep 2005 18:34:35 +0200") Message-ID: <87k6hr2w5q.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: join fails on numerically sorted key fields? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 19:48:46 -0000 sd@sfr.fr writes: > It would be quite helpful for me if if I could use join with > numerically sorted key fields, without having to alpha sort the > files on the key fields, perform join, then numerically resort the > files on the key fields Yes, that would be a nice feature to add. Perhaps you could write the code and documentation? The behavior should be consistent with that of sort -n and/or sort -g, and should use similarly-named options. Of course join can't sort numerically by default, because that would break existing scripts and POSIX doesn't allow it. See . But it sort numerically if you pass it an option. From MAILER-DAEMON Thu Sep 08 16:52:18 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDTNW-000210-8F for mharc-bug-coreutils@gnu.org; Thu, 08 Sep 2005 16:52:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDTNO-0001x6-UH for bug-coreutils@gnu.org; Thu, 08 Sep 2005 16:52:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDTNK-0001uv-KN for bug-coreutils@gnu.org; Thu, 08 Sep 2005 16:52:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDTFj-0000hf-BM for bug-coreutils@gnu.org; Thu, 08 Sep 2005 16:44:11 -0400 Received: from [67.107.182.10] (helo=karl.presidio.alexa.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDT4p-0002pQ-2g for bug-coreutils@gnu.org; Thu, 08 Sep 2005 16:32:55 -0400 Received: from [172.16.1.6] ([192.168.1.177]) by karl.presidio.alexa.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 8 Sep 2005 13:28:14 -0700 Mime-Version: 1.0 Message-Id: In-Reply-To: <87k6hr2w5q.fsf@penguin.cs.ucla.edu> References: <87k6hr2w5q.fsf@penguin.cs.ucla.edu> Date: Thu, 8 Sep 2005 16:25:16 -0400 To: Paul Eggert , sd@sfr.fr From: Andrew D Jewell Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-OriginalArrivalTime: 08 Sep 2005 20:28:14.0400 (UTC) FILETIME=[D6B10C00:01C5B4B3] Cc: bug-coreutils@gnu.org Subject: Re: join fails on numerically sorted key fields? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2005 20:52:09 -0000 Recently, there was work done on a binary search utility, which might be called 'look'. In the process, the code for the command line parsing and complex comparisons of sort were separated out into library functions. In theory you could use this and get all the power of sort's comparison functions with a relatively small amount of work. adj > > It would be quite helpful for me if if I could use join with >> numerically sorted key fields, without having to alpha sort the >> files on the key fields, perform join, then numerically resort the >> files on the key fields > >Yes, that would be a nice feature to add. Perhaps you could write >the code and documentation? The behavior should be consistent >with that of sort -n and/or sort -g, and should use similarly-named >options. > >Of course join can't sort numerically by default, because that would >break existing scripts and POSIX doesn't allow it. See >. >But it sort numerically if you pass it an option. From MAILER-DAEMON Fri Sep 09 16:12:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDpEz-0007MD-FU for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:12:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDmW4-0005ZS-T8 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 13:18:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDmVw-0005Rr-5U for bug-coreutils@gnu.org; Fri, 09 Sep 2005 13:18:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDmVv-0005KN-7q for bug-coreutils@gnu.org; Fri, 09 Sep 2005 13:18:11 -0400 Received: from [161.114.21.104] (helo=ccerelbas01.cce.hp.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EDmW4-0008G6-Gj for bug-coreutils@gnu.org; Fri, 09 Sep 2005 13:18:20 -0400 Received: from mailrelay01.cce.cpqcorp.net (relay.cpqcorp.net [16.47.68.171]) by ccerelbas01.cce.hp.com (Postfix) with ESMTP id EE1462000058 for ; Fri, 9 Sep 2005 12:11:17 -0500 (CDT) Received: from inexc01.tcshp.tcpn.com (unknown [172.31.24.71]) by mailrelay01.cce.cpqcorp.net (Postfix) with SMTP id 062A755E4 for ; Fri, 9 Sep 2005 12:11:16 -0500 (CDT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 9 Sep 2005 22:37:56 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.0.6529.0 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Where can i get the design documentation for core utils? Thread-Index: AcW1YQWznyi1nlBSSamgB+m7KT4wbQ== From: "AbhaySingh Rawat" To: X-Mailman-Approved-At: Fri, 09 Sep 2005 16:12:51 -0400 Subject: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 17:18:24 -0000 Hello, Where can i get the design documentation for core utils? i.e basic = algorithm for the utilities. Sometimes it is difficult to know what a = particular code fragment is doing by just looking at the code itself. Thank you Abhay=20 From MAILER-DAEMON Fri Sep 09 16:54:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDptO-0001Xb-O2 for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:54:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDptH-0001Ti-4m for bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:54:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDptB-0001R4-W3 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:54:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDptB-0001Og-Og for bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:54:25 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDptC-0004UE-Jy for bug-coreutils@gnu.org; Fri, 09 Sep 2005 16:54:26 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j89KsN416353 for ; Fri, 9 Sep 2005 13:54:23 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDpt9-0005C5-91 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 13:54:23 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 09 Sep 2005 13:54:23 -0700 Message-ID: <87acimnerk.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: more "nice" fixes in the area of terminology X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 20:54:36 -0000 I see that I didn't fix all the misuses of the term "nice value" so I installed this further patch. I added a NEWS item. 2005-09-09 Paul Eggert * NEWS: Document "niceness" vs "nice value". * configure.ac (utils_cv_func_setpriority): Simplify the tests. Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is not a priority); all uses changed. * src/nice.c (main): Hoist errno=0 outside the ifdef. * doc/coreutils.texi (nice invocation): Document "niceness" versus "nice value" versus "scheduling priority". --- NEWS 29 Aug 2005 21:14:06 -0000 1.305 +++ NEWS 9 Sep 2005 19:57:59 -0000 @@ -103,6 +103,11 @@ GNU coreutils NEWS --indicator-style=slash. Use --file-type or --indicator-style=file-type to get -p's old behavior. + nice changes: + + Documentation and diagnostics now refer to "nicenesses" (commonly + in the range -20...19 rather than "nice values" (commonly 0...39). + nohup changes: nohup now ignores the umask when creating nohup.out. @@ -270,15 +275,15 @@ GNU coreutils NEWS Fixes for "nice": - If it fails to lower the nice value due to lack of permissions, + If it fails to lower the niceness due to lack of permissions, it goes ahead and runs the command anyway, as POSIX requires. - It no longer incorrectly reports an error if the current nice - value happens to be -1. + It no longer incorrectly reports an error if the current niceness + happens to be -1. - It no longer assumes that nice values range from -20 through 19. + It no longer assumes that nicenesses range from -20 through 19. - It now consistently adjusts out-of-range nice values to the + It now consistently adjusts out-of-range nicenesses to the closest values in range; formerly it sometimes reported an error. pathchk no longer accepts trailing options, e.g., "pathchk -p foo -b" --- configure.ac 23 Aug 2005 16:38:45 -0000 1.61 +++ configure.ac 9 Sep 2005 19:57:59 -0000 @@ -114,29 +114,24 @@ if test $ac_cv_func_syslog = no; then done fi -AC_MSG_CHECKING(for 3-argument setpriority function) -AC_CACHE_VAL(utils_cv_func_setpriority, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], [[setpriority(0, 0, 0);]])], - [utils_cv_func_setpriority=yes], - [utils_cv_func_setpriority=no])]) -AC_MSG_RESULT($utils_cv_func_setpriority) -if test $utils_cv_func_setpriority = yes; then - OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)" - MAN="$MAN nice.1" -else - AC_MSG_CHECKING(for nice function) - AC_CACHE_VAL(utils_cv_func_nice, - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nice();]])], - [utils_cv_func_nice=yes], - [utils_cv_func_nice=no])]) - AC_MSG_RESULT($utils_cv_func_nice) - if test $utils_cv_func_nice = yes; then - AC_DEFINE(NICE_PRIORITY, 1, [FIXME]) - OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)" - MAN="$MAN nice.1" - fi +AC_CACHE_CHECK([for 3-argument setpriority function], + [utils_cv_func_setpriority], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + ]], + [[setpriority (0, 0, 0);]])], + [utils_cv_func_setpriority=yes], + [utils_cv_func_setpriority=no])]) +if test $utils_cv_func_setpriority = no; then + AC_CHECK_FUNCS([nice]) fi +case $utils_cv_func_setpriority,$ac_cv_func_nice in +*yes*) + OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)" + MAN="$MAN nice.1";; +esac AC_DEFUN([coreutils_DUMMY_1], [ --- doc/coreutils.texi.~1.277.~ 2005-09-07 22:34:10.000000000 -0700 +++ doc/coreutils.texi 2005-09-09 13:49:19.000000000 -0700 @@ -12517,6 +12517,16 @@ enforce more restrictive limits. An att outside the supported range is treated as an attempt to use the minimum or maximum supported value. +A niceness should not be confused with a scheduling priority, which +lets applications determine the order in which threads are scheduled +to run. Unlike a priority, a niceness is merely advice to the +scheduler, which the scheduler is free to ignore. Also, as a point of +terminology, @acronym{POSIX} defines the behavior of @command{nice} in +terms of a @dfn{nice value}, which is the nonnegative difference +between a niceness and the minimum niceness. Though @command{nice} +conforms to @command{POSIX}, its documentation and diagnostics use the +term ``niceness'' for compatibility with historical practice. + @var{command} must not be a special built-in utility (@pxref{Special built-in utilities}). --- src/nice.c 8 Sep 2005 06:52:09 -0000 1.84 +++ src/nice.c 9 Sep 2005 19:58:04 -0000 @@ -1,4 +1,4 @@ -/* nice -- run a program with modified nice value +/* nice -- run a program with modified niceness Copyright (C) 1990-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ #include "system.h" -#ifndef NICE_PRIORITY +#if ! HAVE_NICE /* Include this after "system.h" so we're sure to have definitions (from time.h or sys/time.h) required for e.g. the ru_utime member. */ # include @@ -43,7 +43,7 @@ #define AUTHORS "David MacKenzie" -#ifdef NICE_PRIORITY +#if HAVE_NICE # define GET_NICENESS() nice (0) #else # define GET_NICENESS() getpriority (PRIO_PROCESS, 0) @@ -167,7 +167,7 @@ main (int argc, char **argv) error (0, 0, _("a command must be given with an adjustment")); usage (EXIT_FAIL); } - /* No command given; print the nice value. */ + /* No command given; print the niceness. */ errno = 0; current_niceness = GET_NICENESS (); if (current_niceness == -1 && errno != 0) @@ -176,15 +176,14 @@ main (int argc, char **argv) exit (EXIT_SUCCESS); } -#ifndef NICE_PRIORITY errno = 0; +#if HAVE_NICE + ok = (nice (adjustment) != -1 || errno == 0); +#else current_niceness = GET_NICENESS (); if (current_niceness == -1 && errno != 0) error (EXIT_FAIL, errno, _("cannot get niceness")); ok = (setpriority (PRIO_PROCESS, 0, current_niceness + adjustment) == 0); -#else - errno = 0; - ok = (nice (adjustment) != -1 || errno == 0); #endif if (!ok) error (errno == EPERM ? 0 : EXIT_FAIL, errno, _("cannot set niceness")); From MAILER-DAEMON Fri Sep 09 17:18:33 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDqGX-0000Gd-P3 for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:18:33 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDqGV-0000Fs-NT for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:18:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDqGS-0000Dk-6l for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:18:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDqGR-0000BC-ON for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:18:27 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDqFi-0006Ac-FN for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:17:42 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j89LHd418411 for ; Fri, 9 Sep 2005 14:17:39 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDqFf-0005QT-Eb for bug-coreutils@gnu.org; Fri, 09 Sep 2005 14:17:39 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 09 Sep 2005 14:17:39 -0700 Message-ID: <871x3yndos.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: texinfo typo in my recent coreutils patch X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 21:18:32 -0000 I installed this: --- doc/coreutils.texi 9 Sep 2005 20:50:51 -0000 1.278 +++ doc/coreutils.texi 9 Sep 2005 21:16:49 -0000 1.279 @@ -12524,7 +12524,7 @@ scheduler, which the scheduler is free t terminology, @acronym{POSIX} defines the behavior of @command{nice} in terms of a @dfn{nice value}, which is the nonnegative difference between a niceness and the minimum niceness. Though @command{nice} -conforms to @command{POSIX}, its documentation and diagnostics use the +conforms to @acronym{POSIX}, its documentation and diagnostics use the term ``niceness'' for compatibility with historical practice. @var{command} must not be a special built-in utility (@pxref{Special From MAILER-DAEMON Fri Sep 09 17:19:32 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDqHU-0000dc-5S for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:19:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDqF3-0008QB-FL for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:17:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDqEh-0008HQ-Mu for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:16:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDqEg-0008Ej-O7 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:16:38 -0400 Received: from [204.127.198.54] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDqAD-0005nS-D7 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:12:01 -0400 Received: from 204.127.197.115 ([204.127.197.115]) by comcast.net (rwcrmhc14) with SMTP id <2005090921115801400fckd7e>; Fri, 9 Sep 2005 21:11:58 +0000 Received: from [67.172.242.110] by 204.127.197.115; Fri, 09 Sep 2005 21:11:57 +0000 From: ericblake@comcast.net (Eric Blake) To: AbhaySingh Rawat , bug-coreutils@gnu.org Date: Fri, 09 Sep 2005 21:11:57 +0000 Message-Id: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 21:19:30 -0000 > Where can i get the design documentation for core utils? i.e basic algorithm for > the utilities. Sometimes it is difficult to know what a particular code fragment > is doing by just looking at the code itself. Unfortunately, you've stumbled across one of the weakness of open source. Many of the coreutils come from varied backgrounds, with varying levels of documentation, and there is no cohesive design document (besides reading the code itself). Contributions to improve the documentation and code comments are greatly appreciated. -- Eric Blake From MAILER-DAEMON Fri Sep 09 18:03:43 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDqyE-0004oZ-T5 for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:03:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDqyC-0004mX-Tm for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:03:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDqw0-0003bb-Ry for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:01:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDqvx-0003V6-VA for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:01:22 -0400 Received: from [195.135.220.2] (helo=mx1.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EDqns-0000XD-P1 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:53:00 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id BF71EEF2E; Fri, 9 Sep 2005 23:52:56 +0200 (CEST) From: Andreas Schwab To: Paul Eggert References: <87acimnerk.fsf@penguin.cs.ucla.edu> X-Yow: My uncle Murray conquered Egypt in 53 B.C. And I can prove it too!! Date: Fri, 09 Sep 2005 23:52:55 +0200 In-Reply-To: <87acimnerk.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Fri, 09 Sep 2005 13:54:23 -0700") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: more "nice" fixes in the area of terminology X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 22:03:41 -0000 Paul Eggert writes: > --- NEWS 29 Aug 2005 21:14:06 -0000 1.305 > +++ NEWS 9 Sep 2005 19:57:59 -0000 > @@ -103,6 +103,11 @@ GNU coreutils NEWS =20 > --indicator-style=3Dslash. Use --file-type or > --indicator-style=3Dfile-type to get -p's old behavior. > =20 > + nice changes: > + > + Documentation and diagnostics now refer to "nicenesses" (commonly > + in the range -20...19 rather than "nice values" (commonly 0...39). Typo: a close paren is missing. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From MAILER-DAEMON Fri Sep 09 19:34:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDsOH-0008LV-V3 for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 19:34:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDsMs-0007QK-Uh for bug-coreutils@gnu.org; Fri, 09 Sep 2005 19:33:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDsMD-0006vo-VB for bug-coreutils@gnu.org; Fri, 09 Sep 2005 19:32:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDsLb-0005r6-Ue for bug-coreutils@gnu.org; Fri, 09 Sep 2005 19:31:56 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDs7v-0006Tn-R1 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 19:17:48 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j89NHd428428; Fri, 9 Sep 2005 16:17:39 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDs7n-0004g7-IT; Fri, 09 Sep 2005 16:17:39 -0700 To: Kasper Dupont References: <20050808133642.GA20647@hactar.lan> From: Paul Eggert Date: Fri, 09 Sep 2005 16:17:39 -0700 In-Reply-To: <20050808133642.GA20647@hactar.lan> (Kasper Dupont's message of "Mon, 8 Aug 2005 15:36:43 +0200") Message-ID: <87zmqlltkc.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: df patch: add -w option X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 23:34:20 -0000 Kasper Dupont writes: > This patch adds a -w option to df that will change the width > of the device column similar to the IRIX version of df. It > was tested on Fedora Core 1 and Fedora Core 3. Thanks, but I think we'd rather have the column widths adjust themselves, as 'ls' does. Admittedly this is harder to implement, but it'd be easier on users. From MAILER-DAEMON Fri Sep 09 20:41:43 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDtR8-0007XM-Rg for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 20:41:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDtR7-0007WX-H0 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 20:41:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDtR5-0007VQ-9L for bug-coreutils@gnu.org; Fri, 09 Sep 2005 20:41:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDtOr-00065t-Kt for bug-coreutils@gnu.org; Fri, 09 Sep 2005 20:39:21 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDsvS-0001k5-AI for bug-coreutils@gnu.org; Fri, 09 Sep 2005 20:08:58 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8A08p401117; Fri, 9 Sep 2005 17:08:52 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDsvL-0004hM-TN; Fri, 09 Sep 2005 17:08:51 -0700 To: Andreas Schwab References: <87acimnerk.fsf@penguin.cs.ucla.edu> From: Paul Eggert Date: Fri, 09 Sep 2005 17:08:51 -0700 In-Reply-To: (Andreas Schwab's message of "Fri, 09 Sep 2005 23:52:55 +0200") Message-ID: <87d5nhlr70.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: more "nice" fixes in the area of terminology X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2005 00:41:41 -0000 Andreas Schwab writes: >> + Documentation and diagnostics now refer to "nicenesses" (commonly >> + in the range -20...19 rather than "nice values" (commonly 0...39). > > Typo: a close paren is missing. Thanks; I fixed that. From MAILER-DAEMON Fri Sep 09 23:17:17 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDvrh-0006rg-Cg for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 23:17:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDr3v-0006Dq-Kn for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:09:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDr3r-0006BV-0R for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:09:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDr3q-0006BA-Rb for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:09:30 -0400 Received: from [131.246.120.5] (helo=mailgate1.uni-kl.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EDr2v-0001hw-OO for bug-coreutils@gnu.org; Fri, 09 Sep 2005 18:08:34 -0400 Received: from dfki-2203.dfki.uni-kl.de (pc-210.dfki.uni-kl.de [131.246.241.70]) by mailgate1.uni-kl.de (8.13.1/8.13.1) with ESMTP id j89M8Sh6009413 for ; Sat, 10 Sep 2005 00:08:28 +0200 Received: from serv-3100.kl.dfki.de (serv-3100.kl.dfki.de [192.168.31.180]) by dfki-2203.dfki.uni-kl.de (8.11.7p1+Sun/8.11.4) with ESMTP id j89M8SM15049 for ; Sat, 10 Sep 2005 00:08:28 +0200 (MEST) Received: from gast-3117.kl.dfki.de (port-3108.kl.dfki.de [192.168.31.18]) by serv-3100.kl.dfki.de (8.12.10+Sun/8.12.10) with ESMTP id j89M8Rd2015528 for ; Sat, 10 Sep 2005 00:08:27 +0200 (CEST) Received: by gast-3117.kl.dfki.de (Postfix, from userid 500) id 1C2B53061; Sat, 10 Sep 2005 00:07:57 +0200 (CEST) From: Tristan Miller Organization: http://www.nothingisreal.com/ To: bug-coreutils@gnu.org Date: Sat, 10 Sep 2005 00:07:54 +0200 User-Agent: KMail/1.8.2 X-Face: ,|JJNi.kzX63(aV,0XbB~?dW%VP=u--Ye!qJWlt$gXhm)|>,->@; eGma\{@.zaH:Y%lrG7N7jLuDwQMOk^#5nC"TL$0e\}b[tNPO#+0PL{(^MeyEIZ(a]Nu)?NJ|+gU0[.Ih6K]rQ<:o.?w0S5w_HRtmMIU2\#G"<[Me[HtW"N=kz%=4"#\]1hhw7&wZV#<4=vGay/$5&~4{~#z]:m<174,Bfj^E8No!zH+1ZMlB/(2705k&5)(<{|U(Z>C[npKiK; qiGb|jdJ=_~mz X-Mailman-Approved-At: Fri, 09 Sep 2005 23:17:16 -0400 Subject: csplit corrupts files with long lines X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 22:09:37 -0000 --nextPart1462747.BseW4uSGoq Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Greetings. I'm reporting a bug with csplit coreutils 5.2.1, compiled from sources on a= =20 SuSE 9.3 system. It seems this bug was previously reported over a year=20 ago (see=20 )=20 but it was never squashed. In short, csplit produces corrupt output when the input file contains very= =20 long lines. An example file is at=20 , an XML file=20 containing three articles from Wikipedia. The second article was=20 vandalized by a spammer who inserted a ridiculously long line (42280=20 characters) full of links. If I try to split this file with $ csplit wikipedia.xml '//' '{*}' then the file with the second article, xx02, is garbled at the beginning of= =20 the long line. See . Regards, Tristan =2D-=20 _ _V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited / |`-' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D <> = In a haiku, so it's hard (7_\\ http://www.nothingisreal.com/ >< To finish what you --nextPart1462747.BseW4uSGoq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQBDIge7KxGcOu+/SRURApUZAKDQxaf/Gs5xMt5EdW9KRDoDTEYnmQCffTn8 1RoPONBfJXoPdlmms2nngfk= =C+cG -----END PGP SIGNATURE----- --nextPart1462747.BseW4uSGoq-- From MAILER-DAEMON Fri Sep 09 23:19:03 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDvtO-0007RJ-EI for mharc-bug-coreutils@gnu.org; Fri, 09 Sep 2005 23:19:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDqF2-0008Q8-00 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:17:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDqEg-0008Fj-F0 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:16:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDqEe-0008Ej-10 for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:16:36 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDqDq-0005x3-Rt for bug-coreutils@gnu.org; Fri, 09 Sep 2005 17:15:49 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j89LFi418164 for ; Fri, 9 Sep 2005 14:15:44 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EDqDo-0001RP-8A for bug-coreutils@gnu.org; Fri, 09 Sep 2005 14:15:44 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 09 Sep 2005 14:15:43 -0700 Message-ID: <8764tands0.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailman-Approved-At: Fri, 09 Sep 2005 23:18:59 -0400 Subject: fixes for 64-bit regex bugs in coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 21:17:53 -0000 I installed the following to fix some bugs in the coreutils regular expression handling on 64-bit hosts. This is a big patch, but most of it is a straight import from gnulib. The gnulib regex code will probably mutate as a result of feedback from the other glibc maintainers but I don't think this'll affect coreutils proper, so I thought it best to install the necessary coreutils changes now. 2005-09-09 Paul Eggert Support regular expressions in 64-bit code correctly, by importing the latest gnulib regexp code, and not assuming that sizes fit in 32 bits. * src/csplit.c (process_regexp): Store match length in regoff_t, not int. Assume that negative return values less than -2 represent regoff_t overflow. * src/expr.c (docolon): Likewise. * src/nl.c (proc_text): Likewise. * src/ptx.c (SKIP_SOMETHING, find_occurs_in_text): Likewise. * src/tac.c (tac_seekable): Likewise. * src/expr.c (docolon) Check for size calculation overflow. * src/nl.c (build_type_arg): Likewise. * src/ptx.c (matcher_error): New function. (SKIP_SOMETHING): Use it to report matcher errors. (alloc_and_compile_regex): No longer any need to worry about int versus size_t mismatch. * lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c: * lib/regex_internal.h, lib/regexec.c, m4/regex.m4: Import from gnulib. Index: src/csplit.c =================================================================== RCS file: /fetish/cu/src/csplit.c,v retrieving revision 1.143 diff -p -u -r1.143 csplit.c --- src/csplit.c 12 Aug 2005 07:16:25 -0000 1.143 +++ src/csplit.c 9 Sep 2005 20:58:15 -0000 @@ -777,7 +777,7 @@ process_regexp (struct control *p, uintm size_t line_len; /* To make "$" in regexps work. */ uintmax_t break_line; /* First line number of next file. */ bool ignore = p->ignore; /* If true, skip this section. */ - int ret; + regoff_t ret; if (!ignore) create_output_file (); @@ -854,7 +854,7 @@ process_regexp (struct control *p, uintm error (0, 0, _("error in regular expression search")); cleanup_fatal (); } - if (ret >= 0) + if (ret != -1) break; } } Index: src/expr.c =================================================================== RCS file: /fetish/cu/src/expr.c,v retrieving revision 1.106 diff -p -u -r1.106 expr.c --- src/expr.c 16 Jun 2005 21:41:57 -0000 1.106 +++ src/expr.c 9 Sep 2005 20:58:15 -0000 @@ -414,7 +414,7 @@ docolon (VALUE *sv, VALUE *pv) struct re_pattern_buffer re_buffer; struct re_registers re_regs; size_t len; - int matchlen; + regoff_t matchlen; tostring (sv); tostring (pv); @@ -430,10 +430,8 @@ of the basic regular expression is not p len = strlen (pv->u.s); memset (&re_buffer, 0, sizeof (re_buffer)); memset (&re_regs, 0, sizeof (re_regs)); + re_buffer.buffer = xnmalloc (len, 2); re_buffer.allocated = 2 * len; - if (re_buffer.allocated < len) - xalloc_die (); - re_buffer.buffer = xmalloc (re_buffer.allocated); re_buffer.translate = NULL; re_syntax_options = RE_SYNTAX_POSIX_BASIC; errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); @@ -452,7 +450,7 @@ of the basic regular expression is not p else v = int_value (matchlen); } - else + else if (matchlen == -1) { /* Match failed -- return the right kind of null. */ if (re_buffer.re_nsub > 0) @@ -460,6 +458,11 @@ of the basic regular expression is not p else v = int_value (0); } + else + error (EXPR_FAILURE, + (matchlen == -2 ? errno : EOVERFLOW), + _("error in regular expression matcher")); + free (re_buffer.buffer); return v; } Index: src/nl.c =================================================================== RCS file: /fetish/cu/src/nl.c,v retrieving revision 1.85 diff -p -u -r1.85 nl.c --- src/nl.c 14 May 2005 07:58:37 -0000 1.85 +++ src/nl.c 9 Sep 2005 20:58:15 -0000 @@ -247,7 +247,7 @@ build_type_arg (char **typep, struct re_ *typep = optarg++; optlen = strlen (optarg); regexp->allocated = optlen * 2; - regexp->buffer = xmalloc (regexp->allocated); + regexp->buffer = xnmalloc (optlen, 2); regexp->translate = NULL; regexp->fastmap = xmalloc (256); regexp->fastmap_accurate = 0; @@ -342,12 +342,20 @@ proc_text (void) fputs (print_no_line_fmt, stdout); break; case 'p': - if (re_search (current_regex, line_buf.buffer, line_buf.length - 1, - 0, line_buf.length - 1, (struct re_registers *) 0) < 0) - fputs (print_no_line_fmt, stdout); - else - print_lineno (); - break; + switch (re_search (current_regex, line_buf.buffer, line_buf.length - 1, + 0, line_buf.length - 1, (struct re_registers *) 0)) + { + case -2: + error (EXIT_FAILURE, errno, _("error in regular expression search")); + + case -1: + fputs (print_no_line_fmt, stdout); + break; + + default: + print_lineno (); + break; + } } fwrite (line_buf.buffer, sizeof (char), line_buf.length, stdout); } Index: src/ptx.c =================================================================== RCS file: /fetish/cu/src/ptx.c,v retrieving revision 1.51 diff -p -u -r1.51 ptx.c --- src/ptx.c 12 Aug 2005 08:18:18 -0000 1.51 +++ src/ptx.c 9 Sep 2005 20:58:16 -0000 @@ -190,9 +190,11 @@ static BLOCK text_buffer; /* file to stu #define SKIP_SOMETHING(cursor, limit) \ if (word_regex_string) \ { \ - int count; \ + regoff_t count; \ count = re_match (word_regex, cursor, limit - cursor, 0, NULL); \ - cursor += count <= 0 ? 1 : count; \ + if (count == -2) \ + matcher_error (); \ + cursor += count == -1 ? 1 : count; \ } \ else if (word_fastmap[to_uchar (*cursor)]) \ while (cursor < limit && word_fastmap[to_uchar (*cursor)]) \ @@ -278,6 +280,15 @@ static BLOCK reference; /* reference fi /* Miscellaneous routines. */ +/* Diagnose an error in the regular expression matcher. Then exit. */ + +static void ATTRIBUTE_NORETURN +matcher_error (void) +{ + error (0, errno, _("error in regular expression matcher")); + exit (EXIT_FAILURE); +} + /*------------------------------------------------------. | Duplicate string STRING, while evaluating \-escapes. | `------------------------------------------------------*/ @@ -417,12 +428,8 @@ alloc_and_compile_regex (const char *str /* Do not waste extra allocated space. */ - if (pattern->allocated > pattern->used) - { - pattern->buffer - = xrealloc (pattern->buffer, (size_t) pattern->used); - pattern->allocated = pattern->used; - } + pattern->buffer = xrealloc (pattern->buffer, pattern->used); + pattern->allocated = pattern->used; return pattern; } @@ -872,14 +879,21 @@ find_occurs_in_text (void) This test also accounts for the case of an incomplete line or sentence at the end of the buffer. */ - if (context_regex_string - && (re_search (context_regex, cursor, text_buffer.end - cursor, - 0, text_buffer.end - cursor, &context_regs) - >= 0)) - next_context_start = cursor + context_regs.end[0]; + next_context_start = text_buffer.end; + if (context_regex_string) + switch (re_search (context_regex, cursor, text_buffer.end - cursor, + 0, text_buffer.end - cursor, &context_regs)) + { + case -2: + matcher_error (); - else - next_context_start = text_buffer.end; + case -1: + break; + + default: + next_context_start = cursor + context_regs.end[0]; + break; + } /* Include the separator into the right context, but not any suffix white space in this separator; this insures it will be seen in @@ -900,9 +914,11 @@ find_occurs_in_text (void) the loop. */ { - if (re_search (word_regex, cursor, context_end - cursor, - 0, context_end - cursor, &word_regs) - < 0) + regoff_t r = re_search (word_regex, cursor, context_end - cursor, + 0, context_end - cursor, &word_regs); + if (r == -2) + matcher_error (); + if (r == -1) break; word_start = cursor + word_regs.start[0]; word_end = cursor + word_regs.end[0]; Index: src/tac.c =================================================================== RCS file: /fetish/cu/src/tac.c,v retrieving revision 1.124 diff -p -u -r1.124 tac.c --- src/tac.c 11 Jul 2005 18:25:56 -0000 1.124 +++ src/tac.c 9 Sep 2005 20:58:16 -0000 @@ -255,14 +255,18 @@ tac_seekable (int input_fd, const char * Otherwise, make `match_start' < `G_buffer'. */ if (sentinel_length == 0) { - ptrdiff_t i = match_start - G_buffer; - int ret; + size_t i = match_start - G_buffer; + regoff_t ri = i; + regoff_t range = 1 - ri; + regoff_t ret; - if (! (INT_MIN < i && i <= INT_MAX)) + if (1 < range) error (EXIT_FAILURE, 0, _("record too large")); - ret = re_search (&compiled_separator, G_buffer, i, i - 1, -i, ®s); - if (ret == -1) + if (range == 1 + || ((ret = re_search (&compiled_separator, G_buffer, + i, i - 1, range, ®s)) + == -1)) match_start = G_buffer - 1; else if (ret == -2) { Index: lib/regcomp.c =================================================================== RCS file: /fetish/cu/lib/regcomp.c,v retrieving revision 1.4 diff -p -u -r1.4 regcomp.c --- lib/regcomp.c 23 Aug 2005 19:41:09 -0000 1.4 +++ lib/regcomp.c 9 Sep 2005 20:58:16 -0000 @@ -18,11 +18,11 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, - int length, reg_syntax_t syntax); + Idx length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, char *fastmap); -static reg_errcode_t init_dfa (re_dfa_t *dfa, int pat_len); +static reg_errcode_t init_dfa (re_dfa_t *dfa, Idx pat_len); #ifdef RE_ENABLE_I18N static void free_charset (re_charset_t *cset); #endif /* RE_ENABLE_I18N */ @@ -45,14 +45,14 @@ static bin_tree_t *lower_subexp (reg_err static reg_errcode_t calc_first (void *extra, bin_tree_t *node); static reg_errcode_t calc_next (void *extra, bin_tree_t *node); static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node); -static int duplicate_node (re_dfa_t *dfa, int org_idx, unsigned int constraint); -static int search_duplicated_node (re_dfa_t *dfa, int org_node, +static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint); +static Idx search_duplicated_node (const re_dfa_t *dfa, Idx org_node, unsigned int constraint); static reg_errcode_t calc_eclosure (re_dfa_t *dfa); static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, - int node, int root); + Idx node, bool root); static reg_errcode_t calc_inveclosure (re_dfa_t *dfa); -static int fetch_number (re_string_t *input, re_token_t *token, +static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax); static int peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax); @@ -60,16 +60,16 @@ static bin_tree_t *parse (re_string_t *r reg_syntax_t syntax, reg_errcode_t *err); static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err); + Idx nest, reg_errcode_t *err); static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err); + Idx nest, reg_errcode_t *err); static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err); + Idx nest, reg_errcode_t *err); static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err); + Idx nest, reg_errcode_t *err); static bin_tree_t *parse_dup_op (bin_tree_t *dup_elem, re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err); @@ -81,34 +81,34 @@ static reg_errcode_t parse_bracket_eleme re_token_t *token, int token_len, re_dfa_t *dfa, reg_syntax_t syntax, - int accept_hyphen); + bool accept_hyphen); static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token); #ifdef RE_ENABLE_I18N -static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, +static reg_errcode_t build_equiv_class (bitset sbcset, re_charset_t *mbcset, - int *equiv_class_alloc, + Idx *equiv_class_alloc, const unsigned char *name); -static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, - re_bitset_ptr_t sbcset, +static reg_errcode_t build_charclass (unsigned REG_TRANSLATE_TYPE trans, + bitset sbcset, re_charset_t *mbcset, - int *char_class_alloc, + Idx *char_class_alloc, const unsigned char *class_name, reg_syntax_t syntax); #else /* not RE_ENABLE_I18N */ -static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, +static reg_errcode_t build_equiv_class (bitset sbcset, const unsigned char *name); -static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, - re_bitset_ptr_t sbcset, +static reg_errcode_t build_charclass (unsigned REG_TRANSLATE_TYPE trans, + bitset sbcset, const unsigned char *class_name, reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ static bin_tree_t *build_charclass_op (re_dfa_t *dfa, - unsigned RE_TRANSLATE_TYPE trans, + unsigned REG_TRANSLATE_TYPE trans, const unsigned char *class_name, const unsigned char *extra, - int non_match, reg_errcode_t *err); + bool non_match, reg_errcode_t *err); static bin_tree_t *create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type); @@ -206,7 +206,7 @@ const size_t __re_error_msgid_idx[] attr compiles PATTERN (of length LENGTH) and puts the result in BUFP. Returns 0 if the pattern was valid, otherwise an error string. - Assumes the `allocated' (and perhaps `buffer') and `translate' fields + Assumes the `re_allocated' (and perhaps `re_buffer') and `translate' fields are set in BUFP on entry. */ const char * @@ -217,11 +217,11 @@ re_compile_pattern (const char *pattern, /* And GNU code determines whether or not to get register information by passing null for the REGS argument to re_match, etc., not by - setting no_sub, unless RE_NO_SUB is set. */ - bufp->no_sub = !!(re_syntax_options & RE_NO_SUB); + setting re_no_sub, unless REG_NO_SUB is set. */ + bufp->re_no_sub = !!(re_syntax_options & REG_NO_SUB); /* Match anchors at newline. */ - bufp->newline_anchor = 1; + bufp->re_newline_anchor = 1; ret = re_compile_internal (bufp, pattern, length, re_syntax_options); @@ -263,8 +263,8 @@ weak_alias (__re_set_syntax, re_set_synt int re_compile_fastmap (struct re_pattern_buffer *bufp) { - re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; - char *fastmap = bufp->fastmap; + re_dfa_t *dfa = (re_dfa_t *) bufp->re_buffer; + char *fastmap = bufp->re_fastmap; memset (fastmap, '\0', sizeof (char) * SBC_MAX); re_compile_fastmap_iter (bufp, dfa->init_state, fastmap); @@ -274,7 +274,7 @@ re_compile_fastmap (struct re_pattern_bu re_compile_fastmap_iter (bufp, dfa->init_state_nl, fastmap); if (dfa->init_state != dfa->init_state_begbuf) re_compile_fastmap_iter (bufp, dfa->init_state_begbuf, fastmap); - bufp->fastmap_accurate = 1; + bufp->re_fastmap_accurate = 1; return 0; } #ifdef _LIBC @@ -283,7 +283,7 @@ weak_alias (__re_compile_fastmap, re_com static inline void __attribute ((always_inline)) -re_set_fastmap (char *fastmap, int icase, int ch) +re_set_fastmap (char *fastmap, bool icase, int ch) { fastmap[ch] = 1; if (icase) @@ -297,21 +297,22 @@ static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, char *fastmap) { - re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; - int node_cnt; - int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE)); + re_dfa_t *dfa = (re_dfa_t *) bufp->re_buffer; + Idx node_cnt; + bool icase = (dfa->mb_cur_max == 1 && (bufp->re_syntax & REG_IGNORE_CASE)); for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt) { - int node = init_state->nodes.elems[node_cnt]; + Idx node = init_state->nodes.elems[node_cnt]; re_token_type_t type = dfa->nodes[node].type; if (type == CHARACTER) { re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); #ifdef RE_ENABLE_I18N - if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) + if ((bufp->re_syntax & REG_IGNORE_CASE) && dfa->mb_cur_max > 1) { - unsigned char *buf = alloca (dfa->mb_cur_max), *p; + unsigned char buf[MB_LEN_MAX]; + unsigned char *p; wchar_t wc; mbstate_t state; @@ -326,22 +327,22 @@ re_compile_fastmap_iter (regex_t *bufp, &state) == p - buf && (__wcrtomb ((char *) buf, towlower (wc), &state) != (size_t) -1)) - re_set_fastmap (fastmap, 0, buf[0]); + re_set_fastmap (fastmap, false, buf[0]); } #endif } else if (type == SIMPLE_BRACKET) { int i, j, ch; - for (i = 0, ch = 0; i < BITSET_UINTS; ++i) - for (j = 0; j < UINT_BITS; ++j, ++ch) - if (dfa->nodes[node].opr.sbcset[i] & (1 << j)) + for (i = 0, ch = 0; i < BITSET_WORDS; ++i) + for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) + if (dfa->nodes[node].opr.sbcset[i] & ((bitset_word) 1 << j)) re_set_fastmap (fastmap, icase, ch); } #ifdef RE_ENABLE_I18N else if (type == COMPLEX_BRACKET) { - int i; + Idx i; re_charset_t *cset = dfa->nodes[node].opr.mbcset; if (cset->non_match || cset->ncoll_syms || cset->nequiv_classes || cset->nranges || cset->nchar_classes) @@ -355,13 +356,11 @@ re_compile_fastmap_iter (regex_t *bufp, is a valid collation element, and don't catch 'b' since 'b' is the only collation element which starts from 'b'. */ - int j, ch; const int32_t *table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); - for (i = 0, ch = 0; i < BITSET_UINTS; ++i) - for (j = 0; j < UINT_BITS; ++j, ++ch) - if (table[ch] < 0) - re_set_fastmap (fastmap, icase, ch); + for (i = 0; i < SBC_MAX; ++i) + if (table[i] < 0) + re_set_fastmap (fastmap, icase, i); } # else if (dfa->mb_cur_max > 1) @@ -377,11 +376,11 @@ re_compile_fastmap_iter (regex_t *bufp, memset (&state, '\0', sizeof (state)); if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1) re_set_fastmap (fastmap, icase, *(unsigned char *) buf); - if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) + if ((bufp->re_syntax & REG_IGNORE_CASE) && dfa->mb_cur_max > 1) { if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state) != (size_t) -1) - re_set_fastmap (fastmap, 0, *(unsigned char *) buf); + re_set_fastmap (fastmap, false, *(unsigned char *) buf); } } } @@ -394,7 +393,7 @@ re_compile_fastmap_iter (regex_t *bufp, { memset (fastmap, '\1', sizeof (char) * SBC_MAX); if (type == END_OF_RE) - bufp->can_be_null = 1; + bufp->re_can_be_null = 1; return; } } @@ -406,14 +405,14 @@ re_compile_fastmap_iter (regex_t *bufp, PREG is a regex_t *. We do not expect any fields to be initialized, since POSIX says we shouldn't. Thus, we set - `buffer' to the compiled pattern; - `used' to the length of the compiled pattern; - `syntax' to RE_SYNTAX_POSIX_EXTENDED if the + `re_buffer' to the compiled pattern; + `re_used' to the length of the compiled pattern; + `re_syntax' to REG_SYNTAX_POSIX_EXTENDED if the REG_EXTENDED bit in CFLAGS is set; otherwise, to - RE_SYNTAX_POSIX_BASIC; - `newline_anchor' to REG_NEWLINE being set in CFLAGS; - `fastmap' to an allocated space for the fastmap; - `fastmap_accurate' to zero; + REG_SYNTAX_POSIX_BASIC; + `re_newline_anchor' to REG_NEWLINE being set in CFLAGS; + `re_fastmap' to an allocated space for the fastmap; + `re_fastmap_accurate' to zero; `re_nsub' to the number of subexpressions in PATTERN. PATTERN is the address of the pattern string. @@ -440,32 +439,32 @@ int regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { reg_errcode_t ret; - reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED - : RE_SYNTAX_POSIX_BASIC); + reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? REG_SYNTAX_POSIX_EXTENDED + : REG_SYNTAX_POSIX_BASIC); - preg->buffer = NULL; - preg->allocated = 0; - preg->used = 0; + preg->re_buffer = NULL; + preg->re_allocated = 0; + preg->re_used = 0; /* Try to allocate space for the fastmap. */ - preg->fastmap = re_malloc (char, SBC_MAX); - if (BE (preg->fastmap == NULL, 0)) + preg->re_fastmap = re_malloc (char, SBC_MAX); + if (BE (preg->re_fastmap == NULL, 0)) return REG_ESPACE; - syntax |= (cflags & REG_ICASE) ? RE_ICASE : 0; + syntax |= (cflags & REG_ICASE) ? REG_IGNORE_CASE : 0; /* If REG_NEWLINE is set, newlines are treated differently. */ if (cflags & REG_NEWLINE) { /* REG_NEWLINE implies neither . nor [^...] match newline. */ - syntax &= ~RE_DOT_NEWLINE; - syntax |= RE_HAT_LISTS_NOT_NEWLINE; + syntax &= ~REG_DOT_NEWLINE; + syntax |= REG_HAT_LISTS_NOT_NEWLINE; /* It also changes the matching behavior. */ - preg->newline_anchor = 1; + preg->re_newline_anchor = 1; } else - preg->newline_anchor = 0; - preg->no_sub = !!(cflags & REG_NOSUB); - preg->translate = NULL; + preg->re_newline_anchor = 0; + preg->re_no_sub = !!(cflags & REG_NOSUB); + preg->re_translate = NULL; ret = re_compile_internal (preg, pattern, strlen (pattern), syntax); @@ -474,7 +473,7 @@ regcomp (regex_t *__restrict preg, const if (ret == REG_ERPAREN) ret = REG_EPAREN; - /* We have already checked preg->fastmap != NULL. */ + /* We have already checked preg->re_fastmap != NULL. */ if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern buffer. This function never fails in this implementation. */ @@ -482,8 +481,8 @@ regcomp (regex_t *__restrict preg, const else { /* Some error occurred while compiling the expression. */ - re_free (preg->fastmap); - preg->fastmap = NULL; + re_free (preg->re_fastmap); + preg->re_fastmap = NULL; } return (int) ret; @@ -496,7 +495,8 @@ weak_alias (__regcomp, regcomp) from either regcomp or regexec. We don't use PREG here. */ size_t -regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) +regerror (int errcode, const regex_t *__restrict preg, + char *__restrict errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; @@ -544,11 +544,22 @@ weak_alias (__regerror, regerror) static const bitset utf8_sb_map = { /* Set the first 128 bits. */ -# if UINT_MAX == 0xffffffff - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff -# else -# error "Add case for new unsigned int size" +# if 2 < BITSET_WORDS + BITSET_WORD_MAX, +# endif +# if 4 < BITSET_WORDS + BITSET_WORD_MAX, +# endif +# if 6 < BITSET_WORDS + BITSET_WORD_MAX, +# endif +# if 8 < BITSET_WORDS +# error "Invalid BITSET_WORDS" # endif + (BITSET_WORD_MAX + >> (SBC_MAX % BITSET_WORD_BITS == 0 + ? 0 + : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS)) }; #endif @@ -556,7 +567,7 @@ static const bitset utf8_sb_map = static void free_dfa_content (re_dfa_t *dfa) { - int i, j; + Idx i, j; if (dfa->nodes) for (i = 0; i < dfa->nodes_len; ++i) @@ -606,17 +617,17 @@ free_dfa_content (re_dfa_t *dfa) void regfree (regex_t *preg) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; if (BE (dfa != NULL, 1)) free_dfa_content (dfa); - preg->buffer = NULL; - preg->allocated = 0; + preg->re_buffer = NULL; + preg->re_allocated = 0; - re_free (preg->fastmap); - preg->fastmap = NULL; + re_free (preg->re_fastmap); + preg->re_fastmap = NULL; - re_free (preg->translate); - preg->translate = NULL; + re_free (preg->re_translate); + preg->re_translate = NULL; } #ifdef _LIBC weak_alias (__regfree, regfree) @@ -637,32 +648,31 @@ char * regcomp/regexec above without link errors. */ weak_function # endif -re_comp (s) - const char *s; +re_comp (const char *s) { reg_errcode_t ret; char *fastmap; if (!s) { - if (!re_comp_buf.buffer) + if (!re_comp_buf.re_buffer) return gettext ("No previous regular expression"); return 0; } - if (re_comp_buf.buffer) + if (re_comp_buf.re_buffer) { - fastmap = re_comp_buf.fastmap; - re_comp_buf.fastmap = NULL; + fastmap = re_comp_buf.re_fastmap; + re_comp_buf.re_fastmap = NULL; __regfree (&re_comp_buf); memset (&re_comp_buf, '\0', sizeof (re_comp_buf)); - re_comp_buf.fastmap = fastmap; + re_comp_buf.re_fastmap = fastmap; } - if (re_comp_buf.fastmap == NULL) + if (re_comp_buf.re_fastmap == NULL) { - re_comp_buf.fastmap = (char *) malloc (SBC_MAX); - if (re_comp_buf.fastmap == NULL) + re_comp_buf.re_fastmap = (char *) malloc (SBC_MAX); + if (re_comp_buf.re_fastmap == NULL) return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) REG_ESPACE]); } @@ -671,7 +681,7 @@ re_comp (s) don't need to initialize the pattern buffer fields which affect it. */ /* Match anchors at newlines. */ - re_comp_buf.newline_anchor = 1; + re_comp_buf.re_newline_anchor = 1; ret = re_compile_internal (&re_comp_buf, s, strlen (s), re_syntax_options); @@ -696,7 +706,7 @@ libc_freeres_fn (free_mem) SYNTAX indicate regular expression's syntax. */ static reg_errcode_t -re_compile_internal (regex_t *preg, const char * pattern, int length, +re_compile_internal (regex_t *preg, const char *pattern, Idx length, reg_syntax_t syntax) { reg_errcode_t err = REG_NOERROR; @@ -704,29 +714,29 @@ re_compile_internal (regex_t *preg, cons re_string_t regexp; /* Initialize the pattern buffer. */ - preg->fastmap_accurate = 0; - preg->syntax = syntax; - preg->not_bol = preg->not_eol = 0; - preg->used = 0; + preg->re_fastmap_accurate = 0; + preg->re_syntax = syntax; + preg->re_not_bol = preg->re_not_eol = 0; + preg->re_used = 0; preg->re_nsub = 0; - preg->can_be_null = 0; - preg->regs_allocated = REGS_UNALLOCATED; + preg->re_can_be_null = 0; + preg->re_regs_allocated = REG_UNALLOCATED; /* Initialize the dfa. */ - dfa = (re_dfa_t *) preg->buffer; - if (BE (preg->allocated < sizeof (re_dfa_t), 0)) + dfa = (re_dfa_t *) preg->re_buffer; + if (BE (preg->re_allocated < sizeof (re_dfa_t), 0)) { /* If zero allocated, but buffer is non-null, try to realloc enough space. This loses if buffer's address is bogus, but - that is the user's responsibility. If ->buffer is NULL this + that is the user's responsibility. If buffer is null this is a simple allocation. */ - dfa = re_realloc (preg->buffer, re_dfa_t, 1); + dfa = re_realloc (preg->re_buffer, re_dfa_t, 1); if (dfa == NULL) return REG_ESPACE; - preg->allocated = sizeof (re_dfa_t); - preg->buffer = (unsigned char *) dfa; + preg->re_allocated = sizeof (re_dfa_t); + preg->re_buffer = (unsigned char *) dfa; } - preg->used = sizeof (re_dfa_t); + preg->re_used = sizeof (re_dfa_t); __libc_lock_init (dfa->lock); @@ -734,8 +744,8 @@ re_compile_internal (regex_t *preg, cons if (BE (err != REG_NOERROR, 0)) { free_dfa_content (dfa); - preg->buffer = NULL; - preg->allocated = 0; + preg->re_buffer = NULL; + preg->re_allocated = 0; return err; } #ifdef DEBUG @@ -743,16 +753,16 @@ re_compile_internal (regex_t *preg, cons strncpy (dfa->re_str, pattern, length + 1); #endif - err = re_string_construct (®exp, pattern, length, preg->translate, - syntax & RE_ICASE, dfa); + err = re_string_construct (®exp, pattern, length, preg->re_translate, + syntax & REG_IGNORE_CASE, dfa); if (BE (err != REG_NOERROR, 0)) { re_compile_internal_free_return: free_workarea_compile (preg); re_string_destruct (®exp); free_dfa_content (dfa); - preg->buffer = NULL; - preg->allocated = 0; + preg->re_buffer = NULL; + preg->re_allocated = 0; return err; } @@ -769,7 +779,7 @@ re_compile_internal (regex_t *preg, cons #ifdef RE_ENABLE_I18N /* If possible, do searching in single byte encoding to speed things up. */ - if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL) + if (dfa->is_utf8 && !(syntax & REG_IGNORE_CASE) && preg->re_translate == NULL) optimize_utf8 (dfa); #endif @@ -783,8 +793,8 @@ re_compile_internal (regex_t *preg, cons if (BE (err != REG_NOERROR, 0)) { free_dfa_content (dfa); - preg->buffer = NULL; - preg->allocated = 0; + preg->re_buffer = NULL; + preg->re_allocated = 0; } return err; @@ -794,9 +804,9 @@ re_compile_internal (regex_t *preg, cons as the initial length of some arrays. */ static reg_errcode_t -init_dfa (re_dfa_t *dfa, int pat_len) +init_dfa (re_dfa_t *dfa, Idx pat_len) { - int table_size; + __re_size_t table_size; #ifndef _LIBC char *codeset_name; #endif @@ -807,16 +817,14 @@ init_dfa (re_dfa_t *dfa, int pat_len) dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE; dfa->nodes_alloc = pat_len + 1; - dfa->nodes = re_malloc (re_token_t, dfa->nodes_alloc); - - dfa->states_alloc = pat_len + 1; + dfa->nodes = re_xmalloc (re_token_t, dfa->nodes_alloc); /* table_size = 2 ^ ceil(log pat_len) */ - for (table_size = 1; table_size > 0; table_size <<= 1) - if (table_size > pat_len) - break; + for (table_size = 1; table_size <= pat_len; table_size <<= 1) + if (0 < (Idx) -1 && table_size == 0) + return REG_ESPACE; - dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); + dfa->state_table = re_calloc (struct re_state_table_entry, table_size); dfa->state_hash_mask = table_size - 1; dfa->mb_cur_max = MB_CUR_MAX; @@ -859,20 +867,17 @@ init_dfa (re_dfa_t *dfa, int pat_len) { int i, j, ch; - dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset), 1); + dfa->sb_char = re_calloc (bitset_word, BITSET_WORDS); if (BE (dfa->sb_char == NULL, 0)) return REG_ESPACE; - /* Clear all bits by, then set those corresponding to single - byte chars. */ - bitset_empty (dfa->sb_char); - - for (i = 0, ch = 0; i < BITSET_UINTS; ++i) - for (j = 0; j < UINT_BITS; ++j, ++ch) + /* Set the bits corresponding to single byte chars. */ + for (i = 0, ch = 0; i < BITSET_WORDS; ++i) + for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) { wint_t wch = __btowc (ch); if (wch != WEOF) - dfa->sb_char[i] |= 1 << j; + dfa->sb_char[i] |= (bitset_word) 1 << j; # ifndef _LIBC if (isascii (ch) && wch != ch) dfa->map_notascii = 1; @@ -896,10 +901,10 @@ init_word_char (re_dfa_t *dfa) { int i, j, ch; dfa->word_ops_used = 1; - for (i = 0, ch = 0; i < BITSET_UINTS; ++i) - for (j = 0; j < UINT_BITS; ++j, ++ch) + for (i = 0, ch = 0; i < BITSET_WORDS; ++i) + for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) if (isalnum (ch) || ch == '_') - dfa->word_char[i] |= 1 << j; + dfa->word_char[i] |= (bitset_word) 1 << j; } /* Free the work area which are only used while compiling. */ @@ -907,7 +912,7 @@ init_word_char (re_dfa_t *dfa) static void free_workarea_compile (regex_t *preg) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_storage_t *storage, *next; for (storage = dfa->str_tree_storage; storage; storage = next) { @@ -926,7 +931,7 @@ free_workarea_compile (regex_t *preg) static reg_errcode_t create_initial_state (re_dfa_t *dfa) { - int first, i; + Idx first, i; reg_errcode_t err; re_node_set init_nodes; @@ -945,10 +950,10 @@ create_initial_state (re_dfa_t *dfa) if (dfa->nbackref > 0) for (i = 0; i < init_nodes.nelem; ++i) { - int node_idx = init_nodes.elems[i]; + Idx node_idx = init_nodes.elems[i]; re_token_type_t type = dfa->nodes[node_idx].type; - int clexp_idx; + Idx clexp_idx; if (type != OP_BACK_REF) continue; for (clexp_idx = 0; clexp_idx < init_nodes.nelem; ++clexp_idx) @@ -964,7 +969,7 @@ create_initial_state (re_dfa_t *dfa) if (type == OP_BACK_REF) { - int dest_idx = dfa->edests[node_idx].elems[0]; + Idx dest_idx = dfa->edests[node_idx].elems[0]; if (!re_node_set_contains (&init_nodes, dest_idx)) { re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx); @@ -1008,14 +1013,17 @@ create_initial_state (re_dfa_t *dfa) static void optimize_utf8 (re_dfa_t *dfa) { - int node, i, mb_chars = 0, has_period = 0; + Idx node; + int i; + bool mb_chars = false; + bool has_period = false; for (node = 0; node < dfa->nodes_len; ++node) switch (dfa->nodes[node].type) { case CHARACTER: if (dfa->nodes[node].opr.c >= 0x80) - mb_chars = 1; + mb_chars = true; break; case ANCHOR: switch (dfa->nodes[node].opr.idx) @@ -1031,7 +1039,7 @@ optimize_utf8 (re_dfa_t *dfa) } break; case OP_PERIOD: - has_period = 1; + has_period = true; break; case OP_BACK_REF: case OP_ALT: @@ -1044,9 +1052,18 @@ optimize_utf8 (re_dfa_t *dfa) return; case SIMPLE_BRACKET: /* Just double check. */ - for (i = 0x80 / UINT_BITS; i < BITSET_UINTS; ++i) - if (dfa->nodes[node].opr.sbcset[i]) - return; + { + int rshift = + (SBC_MAX / 2 % BITSET_WORD_BITS == 0 + ? 0 + : BITSET_WORD_BITS - SBC_MAX / 2 % BITSET_WORD_BITS); + for (i = SBC_MAX / 2 / BITSET_WORD_BITS; i < BITSET_WORDS; ++i) + { + if (dfa->nodes[node].opr.sbcset[i] >> rshift != 0) + return; + rshift = 0; + } + } break; default: abort (); @@ -1075,22 +1092,22 @@ optimize_utf8 (re_dfa_t *dfa) static reg_errcode_t analyze (regex_t *preg) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; reg_errcode_t ret; /* Allocate arrays. */ - dfa->nexts = re_malloc (int, dfa->nodes_alloc); - dfa->org_indices = re_malloc (int, dfa->nodes_alloc); - dfa->edests = re_malloc (re_node_set, dfa->nodes_alloc); + dfa->nexts = re_malloc (Idx, dfa->nodes_alloc); + dfa->org_indices = re_malloc (Idx, dfa->nodes_alloc); + dfa->edests = re_xmalloc (re_node_set, dfa->nodes_alloc); dfa->eclosures = re_malloc (re_node_set, dfa->nodes_alloc); if (BE (dfa->nexts == NULL || dfa->org_indices == NULL || dfa->edests == NULL || dfa->eclosures == NULL, 0)) return REG_ESPACE; - dfa->subexp_map = re_malloc (int, preg->re_nsub); + dfa->subexp_map = re_xmalloc (Idx, preg->re_nsub); if (dfa->subexp_map != NULL) { - int i; + Idx i; for (i = 0; i < preg->re_nsub; i++) dfa->subexp_map[i] = i; preorder (dfa->str_tree, optimize_subexps, dfa); @@ -1120,10 +1137,10 @@ analyze (regex_t *preg) /* We only need this during the prune_impossible_nodes pass in regexec.c; skip it if p_i_n will not run, as calc_inveclosure can be quadratic. */ - if ((!preg->no_sub && preg->re_nsub > 0 && dfa->has_plural_match) + if ((!preg->re_no_sub && preg->re_nsub > 0 && dfa->has_plural_match) || dfa->nbackref) { - dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len); + dfa->inveclosures = re_xmalloc (re_node_set, dfa->nodes_len); if (BE (dfa->inveclosures == NULL, 0)) return REG_ESPACE; ret = calc_inveclosure (dfa); @@ -1215,15 +1232,15 @@ optimize_subexps (void *extra, bin_tree_ else if (node->token.type == SUBEXP && node->left && node->left->token.type == SUBEXP) { - int other_idx = node->left->token.opr.idx; + Idx other_idx = node->left->token.opr.idx; node->left = node->left->left; if (node->left) node->left->parent = node; dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx]; - if (other_idx < 8 * sizeof (dfa->used_bkref_map)) - dfa->used_bkref_map &= ~(1 << other_idx); + if (other_idx < BITSET_WORD_BITS) + dfa->used_bkref_map &= ~ ((bitset_word) 1 << other_idx); } return REG_NOERROR; @@ -1256,18 +1273,18 @@ lower_subexps (void *extra, bin_tree_t * static bin_tree_t * lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_t *body = node->left; bin_tree_t *op, *cls, *tree1, *tree; - if (preg->no_sub + if (preg->re_no_sub /* We do not optimize empty subexpressions, because otherwise we may have bad CONCAT nodes with NULL children. This is obviously not very common, so we do not lose much. An example that triggers this case is the sed "script" /\(\)/x. */ && node->left != NULL - && (node->token.opr.idx >= 8 * sizeof (dfa->used_bkref_map) - || !(dfa->used_bkref_map & (1 << node->token.opr.idx)))) + && ! (node->token.opr.idx < BITSET_WORD_BITS + && dfa->used_bkref_map & ((bitset_word) 1 << node->token.opr.idx))) return node->left; /* Convert the SUBEXP node to the concatenation of an @@ -1302,7 +1319,7 @@ calc_first (void *extra, bin_tree_t *nod { node->first = node; node->node_idx = re_dfa_add_node (dfa, node->token); - if (BE (node->node_idx == -1, 0)) + if (BE (node->node_idx == REG_MISSING, 0)) return REG_ESPACE; } return REG_NOERROR; @@ -1336,7 +1353,7 @@ static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node) { re_dfa_t *dfa = (re_dfa_t *) extra; - int idx = node->node_idx; + Idx idx = node->node_idx; reg_errcode_t err = REG_NOERROR; switch (node->token.type) @@ -1351,7 +1368,7 @@ link_nfa_nodes (void *extra, bin_tree_t case OP_DUP_ASTERISK: case OP_ALT: { - int left, right; + Idx left, right; dfa->has_plural_match = 1; if (node->left != NULL) left = node->left->first->node_idx; @@ -1361,8 +1378,8 @@ link_nfa_nodes (void *extra, bin_tree_t right = node->right->first->node_idx; else right = node->next->node_idx; - assert (left > -1); - assert (right > -1); + assert (REG_VALID_INDEX (left)); + assert (REG_VALID_INDEX (right)); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; @@ -1393,14 +1410,16 @@ link_nfa_nodes (void *extra, bin_tree_t to their own constraint. */ static reg_errcode_t -duplicate_node_closure (re_dfa_t *dfa, int top_org_node, int top_clone_node, - int root_node, unsigned int init_constraint) +duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, + Idx top_clone_node, Idx root_node, + unsigned int init_constraint) { - int org_node, clone_node, ret; + Idx org_node, clone_node; + bool ok; unsigned int constraint = init_constraint; for (org_node = top_org_node, clone_node = top_clone_node;;) { - int org_dest, clone_dest; + Idx org_dest, clone_dest; if (dfa->nodes[org_node].type == OP_BACK_REF) { /* If the back reference epsilon-transit, its destination must @@ -1410,11 +1429,11 @@ duplicate_node_closure (re_dfa_t *dfa, i org_dest = dfa->nexts[org_node]; re_node_set_empty (dfa->edests + clone_node); clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == -1, 0)) + if (BE (clone_dest == REG_MISSING, 0)) return REG_ESPACE; dfa->nexts[clone_node] = dfa->nexts[org_node]; - ret = re_node_set_insert (dfa->edests + clone_node, clone_dest); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); + if (BE (! ok, 0)) return REG_ESPACE; } else if (dfa->edests[org_node].nelem == 0) @@ -1439,19 +1458,19 @@ duplicate_node_closure (re_dfa_t *dfa, i /* ...but if the node is root_node itself, it means the epsilon closure have a loop, then tie it to the destination of the root_node. */ - ret = re_node_set_insert (dfa->edests + clone_node, + ok = re_node_set_insert (dfa->edests + clone_node, org_dest); - if (BE (ret < 0, 0)) + if (BE (! ok, 0)) return REG_ESPACE; break; } constraint |= dfa->nodes[org_node].opr.ctx_type; } clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == -1, 0)) + if (BE (clone_dest == REG_MISSING, 0)) return REG_ESPACE; - ret = re_node_set_insert (dfa->edests + clone_node, clone_dest); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); + if (BE (! ok, 0)) return REG_ESPACE; } else /* dfa->edests[org_node].nelem == 2 */ @@ -1462,15 +1481,15 @@ duplicate_node_closure (re_dfa_t *dfa, i re_node_set_empty (dfa->edests + clone_node); /* Search for a duplicated node which satisfies the constraint. */ clone_dest = search_duplicated_node (dfa, org_dest, constraint); - if (clone_dest == -1) + if (clone_dest == REG_MISSING) { /* There are no such a duplicated node, create a new one. */ reg_errcode_t err; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == -1, 0)) + if (BE (clone_dest == REG_MISSING, 0)) return REG_ESPACE; - ret = re_node_set_insert (dfa->edests + clone_node, clone_dest); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); + if (BE (! ok, 0)) return REG_ESPACE; err = duplicate_node_closure (dfa, org_dest, clone_dest, root_node, constraint); @@ -1481,17 +1500,17 @@ duplicate_node_closure (re_dfa_t *dfa, i { /* There are a duplicated node which satisfy the constraint, use it to avoid infinite loop. */ - ret = re_node_set_insert (dfa->edests + clone_node, clone_dest); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); + if (BE (! ok, 0)) return REG_ESPACE; } org_dest = dfa->edests[org_node].elems[1]; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == -1, 0)) + if (BE (clone_dest == REG_MISSING, 0)) return REG_ESPACE; - ret = re_node_set_insert (dfa->edests + clone_node, clone_dest); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); + if (BE (! ok, 0)) return REG_ESPACE; } org_node = org_dest; @@ -1503,28 +1522,29 @@ duplicate_node_closure (re_dfa_t *dfa, i /* Search for a node which is duplicated from the node ORG_NODE, and satisfies the constraint CONSTRAINT. */ -static int -search_duplicated_node (re_dfa_t *dfa, int org_node, unsigned int constraint) +static Idx +search_duplicated_node (const re_dfa_t *dfa, Idx org_node, + unsigned int constraint) { - int idx; + Idx idx; for (idx = dfa->nodes_len - 1; dfa->nodes[idx].duplicated && idx > 0; --idx) { if (org_node == dfa->org_indices[idx] && constraint == dfa->nodes[idx].constraint) return idx; /* Found. */ } - return -1; /* Not found. */ + return REG_MISSING; /* Not found. */ } /* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT. - Return the index of the new node, or -1 if insufficient storage is + Return the index of the new node, or REG_MISSING if insufficient storage is available. */ -static int -duplicate_node (re_dfa_t *dfa, int org_idx, unsigned int constraint) +static Idx +duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint) { - int dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]); - if (BE (dup_idx != -1, 1)) + Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]); + if (BE (dup_idx != REG_MISSING, 1)) { dfa->nodes[dup_idx].constraint = constraint; if (dfa->nodes[org_idx].type == ANCHOR) @@ -1540,17 +1560,18 @@ duplicate_node (re_dfa_t *dfa, int org_i static reg_errcode_t calc_inveclosure (re_dfa_t *dfa) { - int src, idx, ret; + Idx src, idx; + bool ok; for (idx = 0; idx < dfa->nodes_len; ++idx) re_node_set_init_empty (dfa->inveclosures + idx); for (src = 0; src < dfa->nodes_len; ++src) { - int *elems = dfa->eclosures[src].elems; + Idx *elems = dfa->eclosures[src].elems; for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx) { - ret = re_node_set_insert_last (dfa->inveclosures + elems[idx], src); - if (BE (ret == -1, 0)) + ok = re_node_set_insert_last (dfa->inveclosures + elems[idx], src); + if (BE (! ok, 0)) return REG_ESPACE; } } @@ -1563,11 +1584,12 @@ calc_inveclosure (re_dfa_t *dfa) static reg_errcode_t calc_eclosure (re_dfa_t *dfa) { - int node_idx, incomplete; + Idx node_idx; + bool incomplete; #ifdef DEBUG assert (dfa->nodes_len > 0); #endif - incomplete = 0; + incomplete = false; /* For each nodes, calculate epsilon closure. */ for (node_idx = 0; ; ++node_idx) { @@ -1577,25 +1599,25 @@ calc_eclosure (re_dfa_t *dfa) { if (!incomplete) break; - incomplete = 0; + incomplete = false; node_idx = 0; } #ifdef DEBUG - assert (dfa->eclosures[node_idx].nelem != -1); + assert (dfa->eclosures[node_idx].nelem != REG_MISSING); #endif /* If we have already calculated, skip it. */ if (dfa->eclosures[node_idx].nelem != 0) continue; /* Calculate epsilon closure of `node_idx'. */ - err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, 1); + err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true); if (BE (err != REG_NOERROR, 0)) return err; if (dfa->eclosures[node_idx].nelem == 0) { - incomplete = 1; + incomplete = true; re_node_set_free (&eclosure_elem); } } @@ -1605,20 +1627,22 @@ calc_eclosure (re_dfa_t *dfa) /* Calculate epsilon closure of NODE. */ static reg_errcode_t -calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root) +calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) { reg_errcode_t err; unsigned int constraint; - int i, incomplete; + Idx i; + bool incomplete; + bool ok; re_node_set eclosure; - incomplete = 0; + incomplete = false; err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1); if (BE (err != REG_NOERROR, 0)) return err; /* This indicates that we are calculating this node now. We reference this value to avoid infinite loop. */ - dfa->eclosures[node].nelem = -1; + dfa->eclosures[node].nelem = REG_MISSING; constraint = ((dfa->nodes[node].type == ANCHOR) ? dfa->nodes[node].opr.ctx_type : 0); @@ -1628,7 +1652,7 @@ calc_eclosure_iter (re_node_set *new_set && dfa->edests[node].nelem && !dfa->nodes[dfa->edests[node].elems[0]].duplicated) { - int org_node, cur_node; + Idx org_node, cur_node; org_node = cur_node = node; err = duplicate_node_closure (dfa, node, node, node, constraint); if (BE (err != REG_NOERROR, 0)) @@ -1640,19 +1664,19 @@ calc_eclosure_iter (re_node_set *new_set for (i = 0; i < dfa->edests[node].nelem; ++i) { re_node_set eclosure_elem; - int edest = dfa->edests[node].elems[i]; + Idx edest = dfa->edests[node].elems[i]; /* If calculating the epsilon closure of `edest' is in progress, return intermediate result. */ - if (dfa->eclosures[edest].nelem == -1) + if (dfa->eclosures[edest].nelem == REG_MISSING) { - incomplete = 1; + incomplete = true; continue; } /* If we haven't calculated the epsilon closure of `edest' yet, calculate now. Otherwise use calculated epsilon closure. */ if (dfa->eclosures[edest].nelem == 0) { - err = calc_eclosure_iter (&eclosure_elem, dfa, edest, 0); + err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false); if (BE (err != REG_NOERROR, 0)) return err; } @@ -1664,13 +1688,15 @@ calc_eclosure_iter (re_node_set *new_set the epsilon closure of this node is also incomplete. */ if (dfa->eclosures[edest].nelem == 0) { - incomplete = 1; + incomplete = true; re_node_set_free (&eclosure_elem); } } /* Epsilon closures include itself. */ - re_node_set_insert (&eclosure, node); + ok = re_node_set_insert (&eclosure, node); + if (BE (! ok, 0)) + return REG_ESPACE; if (incomplete && !root) dfa->eclosures[node].nelem = 0; else @@ -1744,97 +1770,97 @@ peek_token (re_token_t *token, re_string switch (c2) { case '|': - if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_NO_BK_VBAR)) + if (!(syntax & REG_LIMITED_OPS) && !(syntax & REG_NO_BK_VBAR)) token->type = OP_ALT; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - if (!(syntax & RE_NO_BK_REFS)) + if (!(syntax & REG_NO_BK_REFS)) { token->type = OP_BACK_REF; token->opr.idx = c2 - '1'; } break; case '<': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_FIRST; } break; case '>': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_LAST; } break; case 'b': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = WORD_DELIM; } break; case 'B': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = NOT_WORD_DELIM; } break; case 'w': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) token->type = OP_WORD; break; case 'W': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) token->type = OP_NOTWORD; break; case 's': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) token->type = OP_SPACE; break; case 'S': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) token->type = OP_NOTSPACE; break; case '`': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = BUF_FIRST; } break; case '\'': - if (!(syntax & RE_NO_GNU_OPS)) + if (!(syntax & REG_NO_GNU_OPS)) { token->type = ANCHOR; token->opr.ctx_type = BUF_LAST; } break; case '(': - if (!(syntax & RE_NO_BK_PARENS)) + if (!(syntax & REG_NO_BK_PARENS)) token->type = OP_OPEN_SUBEXP; break; case ')': - if (!(syntax & RE_NO_BK_PARENS)) + if (!(syntax & REG_NO_BK_PARENS)) token->type = OP_CLOSE_SUBEXP; break; case '+': - if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM)) + if (!(syntax & REG_LIMITED_OPS) && (syntax & REG_BK_PLUS_QM)) token->type = OP_DUP_PLUS; break; case '?': - if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM)) + if (!(syntax & REG_LIMITED_OPS) && (syntax & REG_BK_PLUS_QM)) token->type = OP_DUP_QUESTION; break; case '{': - if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES))) + if ((syntax & REG_INTERVALS) && (!(syntax & REG_NO_BK_BRACES))) token->type = OP_OPEN_DUP_NUM; break; case '}': - if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES))) + if ((syntax & REG_INTERVALS) && (!(syntax & REG_NO_BK_BRACES))) token->type = OP_CLOSE_DUP_NUM; break; default: @@ -1857,38 +1883,38 @@ peek_token (re_token_t *token, re_string switch (c) { case '\n': - if (syntax & RE_NEWLINE_ALT) + if (syntax & REG_NEWLINE_ALT) token->type = OP_ALT; break; case '|': - if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_NO_BK_VBAR)) + if (!(syntax & REG_LIMITED_OPS) && (syntax & REG_NO_BK_VBAR)) token->type = OP_ALT; break; case '*': token->type = OP_DUP_ASTERISK; break; case '+': - if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM)) + if (!(syntax & REG_LIMITED_OPS) && !(syntax & REG_BK_PLUS_QM)) token->type = OP_DUP_PLUS; break; case '?': - if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM)) + if (!(syntax & REG_LIMITED_OPS) && !(syntax & REG_BK_PLUS_QM)) token->type = OP_DUP_QUESTION; break; case '{': - if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) + if ((syntax & REG_INTERVALS) && (syntax & REG_NO_BK_BRACES)) token->type = OP_OPEN_DUP_NUM; break; case '}': - if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) + if ((syntax & REG_INTERVALS) && (syntax & REG_NO_BK_BRACES)) token->type = OP_CLOSE_DUP_NUM; break; case '(': - if (syntax & RE_NO_BK_PARENS) + if (syntax & REG_NO_BK_PARENS) token->type = OP_OPEN_SUBEXP; break; case ')': - if (syntax & RE_NO_BK_PARENS) + if (syntax & REG_NO_BK_PARENS) token->type = OP_CLOSE_SUBEXP; break; case '[': @@ -1898,18 +1924,18 @@ peek_token (re_token_t *token, re_string token->type = OP_PERIOD; break; case '^': - if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) && + if (!(syntax & (REG_CONTEXT_INDEP_ANCHORS | REG_CARET_ANCHORS_HERE)) && re_string_cur_idx (input) != 0) { char prev = re_string_peek_byte (input, -1); - if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') + if (!(syntax & REG_NEWLINE_ALT) || prev != '\n') break; } token->type = ANCHOR; token->opr.ctx_type = LINE_FIRST; break; case '$': - if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && + if (!(syntax & REG_CONTEXT_INDEP_ANCHORS) && re_string_cur_idx (input) + 1 != re_string_length (input)) { re_token_t next; @@ -1952,7 +1978,7 @@ peek_token_bracket (re_token_t *token, r } #endif /* RE_ENABLE_I18N */ - if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) + if (c == '\\' && (syntax & REG_BACKSLASH_ESCAPE_IN_LISTS) && re_string_cur_idx (input) + 1 < re_string_length (input)) { /* In this case, '\' escape a character. */ @@ -1982,7 +2008,7 @@ peek_token_bracket (re_token_t *token, r token->type = OP_OPEN_EQUIV_CLASS; break; case ':': - if (syntax & RE_CHAR_CLASSES) + if (syntax & REG_CHAR_CLASSES) { token->type = OP_OPEN_CHAR_CLASS; break; @@ -2031,11 +2057,11 @@ static bin_tree_t * parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_t *tree, *eor, *root; re_token_t current_token; dfa->syntax = syntax; - fetch_token (¤t_token, regexp, syntax | RE_CARET_ANCHORS_HERE); + fetch_token (¤t_token, regexp, syntax | REG_CARET_ANCHORS_HERE); tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2063,9 +2089,9 @@ parse (re_string_t *regexp, regex_t *pre static bin_tree_t * parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, - reg_syntax_t syntax, int nest, reg_errcode_t *err) + reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_t *tree, *branch = NULL; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) @@ -2073,7 +2099,7 @@ parse_reg_exp (re_string_t *regexp, rege while (token->type == OP_ALT) { - fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); + fetch_token (token, regexp, syntax | REG_CARET_ANCHORS_HERE); if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { @@ -2104,10 +2130,10 @@ parse_reg_exp (re_string_t *regexp, rege static bin_tree_t * parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, - reg_syntax_t syntax, int nest, reg_errcode_t *err) + reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { bin_tree_t *tree, *exp; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; tree = parse_expression (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2144,9 +2170,9 @@ parse_branch (re_string_t *regexp, regex static bin_tree_t * parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, - reg_syntax_t syntax, int nest, reg_errcode_t *err) + reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_t *tree; switch (token->type) { @@ -2203,7 +2229,7 @@ parse_expression (re_string_t *regexp, r dfa->has_mb_node = 1; break; case OP_OPEN_DUP_NUM: - if (syntax & RE_CONTEXT_INVALID_DUP) + if (syntax & REG_CONTEXT_INVALID_DUP) { *err = REG_BADRPT; return NULL; @@ -2212,12 +2238,12 @@ parse_expression (re_string_t *regexp, r case OP_DUP_ASTERISK: case OP_DUP_PLUS: case OP_DUP_QUESTION: - if (syntax & RE_CONTEXT_INVALID_OPS) + if (syntax & REG_CONTEXT_INVALID_OPS) { *err = REG_BADRPT; return NULL; } - else if (syntax & RE_CONTEXT_INDEP_OPS) + else if (syntax & REG_CONTEXT_INDEP_OPS) { fetch_token (token, regexp, syntax); return parse_expression (regexp, preg, token, syntax, nest, err); @@ -2225,7 +2251,7 @@ parse_expression (re_string_t *regexp, r /* else fall through */ case OP_CLOSE_SUBEXP: if ((token->type == OP_CLOSE_SUBEXP) && - !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) + !(syntax & REG_UNMATCHED_RIGHT_PAREN_ORD)) { *err = REG_ERPAREN; return NULL; @@ -2339,7 +2365,7 @@ parse_expression (re_string_t *regexp, r if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; /* In BRE consecutive duplications are not allowed. */ - if ((syntax & RE_CONTEXT_INVALID_DUP) + if ((syntax & REG_CONTEXT_INVALID_DUP) && (token->type == OP_DUP_ASTERISK || token->type == OP_OPEN_DUP_NUM)) { @@ -2360,14 +2386,14 @@ parse_expression (re_string_t *regexp, r static bin_tree_t * parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, - reg_syntax_t syntax, int nest, reg_errcode_t *err) + reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; bin_tree_t *tree; size_t cur_nsub; cur_nsub = preg->re_nsub++; - fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); + fetch_token (token, regexp, syntax | REG_CARET_ANCHORS_HERE); /* The subexpression may be a null string. */ if (token->type == OP_CLOSE_SUBEXP) @@ -2380,7 +2406,9 @@ parse_sub_exp (re_string_t *regexp, rege if (BE (*err != REG_NOERROR, 0)) return NULL; } - dfa->completed_bkref_map |= 1 << cur_nsub; + + if (cur_nsub <= '9' - '1') + dfa->completed_bkref_map |= 1 << cur_nsub; tree = create_tree (dfa, tree, NULL, SUBEXP); if (BE (tree == NULL, 0)) @@ -2399,14 +2427,14 @@ parse_dup_op (bin_tree_t *elem, re_strin re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err) { bin_tree_t *tree = NULL, *old_tree = NULL; - int i, start, end, start_idx = re_string_cur_idx (regexp); + Idx i, start, end, start_idx = re_string_cur_idx (regexp); re_token_t start_token = *token; if (token->type == OP_OPEN_DUP_NUM) { end = 0; start = fetch_number (regexp, token, syntax); - if (start == -1) + if (start == REG_MISSING) { if (token->type == CHARACTER && token->opr.c == ',') start = 0; /* We treat "{,m}" as "{0,m}". */ @@ -2416,17 +2444,17 @@ parse_dup_op (bin_tree_t *elem, re_strin return NULL; } } - if (BE (start != -2, 1)) + if (BE (start != REG_ERROR, 1)) { /* We treat "{n}" as "{n,n}". */ end = ((token->type == OP_CLOSE_DUP_NUM) ? start : ((token->type == CHARACTER && token->opr.c == ',') - ? fetch_number (regexp, token, syntax) : -2)); + ? fetch_number (regexp, token, syntax) : REG_ERROR)); } - if (BE (start == -2 || end == -2, 0)) + if (BE (start == REG_ERROR || end == REG_ERROR, 0)) { /* Invalid sequence. */ - if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) + if (BE (!(syntax & REG_INVALID_INTERVAL_ORD), 0)) { if (token->type == END_OF_RE) *err = REG_EBRACE; @@ -2445,7 +2473,7 @@ parse_dup_op (bin_tree_t *elem, re_strin return elem; } - if (BE (end != -1 && start > end, 0)) + if (BE (end != REG_MISSING && start > end, 0)) { /* First number greater than second. */ *err = REG_BADBR; @@ -2455,7 +2483,7 @@ parse_dup_op (bin_tree_t *elem, re_strin else { start = (token->type == OP_DUP_PLUS) ? 1 : 0; - end = (token->type == OP_DUP_QUESTION) ? 1 : -1; + end = (token->type == OP_DUP_QUESTION) ? 1 : REG_MISSING; } fetch_token (token, regexp, syntax); @@ -2493,24 +2521,26 @@ parse_dup_op (bin_tree_t *elem, re_strin if (elem->token.type == SUBEXP) postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx); - tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT)); + tree = create_tree (dfa, elem, NULL, + (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT)); if (BE (tree == NULL, 0)) goto parse_dup_op_espace; - /* This loop is actually executed only when end != -1, + /* This loop is actually executed only when end != REG_MISSING, to rewrite {0,n} as ((...?)?)?... We have already created the start+1-th copy. */ - for (i = start + 2; i <= end; ++i) - { - elem = duplicate_tree (elem, dfa); - tree = create_tree (dfa, tree, elem, CONCAT); - if (BE (elem == NULL || tree == NULL, 0)) - goto parse_dup_op_espace; - - tree = create_tree (dfa, tree, NULL, OP_ALT); - if (BE (tree == NULL, 0)) - goto parse_dup_op_espace; - } + if ((Idx) -1 < 0 || end != REG_MISSING) + for (i = start + 2; i <= end; ++i) + { + elem = duplicate_tree (elem, dfa); + tree = create_tree (dfa, tree, elem, CONCAT); + if (BE (elem == NULL || tree == NULL, 0)) + goto parse_dup_op_espace; + + tree = create_tree (dfa, tree, NULL, OP_ALT); + if (BE (tree == NULL, 0)) + goto parse_dup_op_espace; + } if (old_tree) tree = create_tree (dfa, old_tree, tree, CONCAT); @@ -2535,9 +2565,9 @@ parse_dup_op (bin_tree_t *elem, re_strin update it. */ static reg_errcode_t -build_range_exp (re_bitset_ptr_t sbcset, +build_range_exp (bitset sbcset, # ifdef RE_ENABLE_I18N - re_charset_t *mbcset, int *range_alloc, + re_charset_t *mbcset, Idx *range_alloc, # endif bracket_elem_t *start_elem, bracket_elem_t *end_elem) { @@ -2591,14 +2621,13 @@ build_range_exp (re_bitset_ptr_t sbcset, { /* There is not enough space, need realloc. */ wchar_t *new_array_start, *new_array_end; - int new_nranges; + Idx new_nranges; - /* +1 in case of mbcset->nranges is 0. */ - new_nranges = 2 * mbcset->nranges + 1; + new_nranges = mbcset->nranges; /* Use realloc since mbcset->range_starts and mbcset->range_ends are NULL if *range_alloc == 0. */ - new_array_start = re_realloc (mbcset->range_starts, wchar_t, - new_nranges); + new_array_start = re_x2realloc (mbcset->range_starts, wchar_t, + &new_nranges); new_array_end = re_realloc (mbcset->range_ends, wchar_t, new_nranges); @@ -2652,9 +2681,9 @@ build_range_exp (re_bitset_ptr_t sbcset, pointer argument since we may update it. */ static reg_errcode_t -build_collating_symbol (re_bitset_ptr_t sbcset, +build_collating_symbol (bitset sbcset, # ifdef RE_ENABLE_I18N - re_charset_t *mbcset, int *coll_sym_alloc, + re_charset_t *mbcset, Idx *coll_sym_alloc, # endif const unsigned char *name) { @@ -2690,9 +2719,7 @@ parse_bracket_exp (re_string_t *regexp, auto inline int32_t __attribute ((always_inline)) - seek_collating_symbol_entry (name, name_len) - const unsigned char *name; - size_t name_len; + seek_collating_symbol_entry (const unsigned char *name, size_t name_len) { int32_t hash = elem_hash ((const char *) name, name_len); int32_t elem = hash % table_size; @@ -2723,8 +2750,7 @@ parse_bracket_exp (re_string_t *regexp, auto inline unsigned int __attribute ((always_inline)) - lookup_collation_sequence_value (br_elem) - bracket_elem_t *br_elem; + lookup_collation_sequence_value (bracket_elem_t *br_elem) { if (br_elem->type == SB_CHAR) { @@ -2791,11 +2817,9 @@ parse_bracket_exp (re_string_t *regexp, auto inline reg_errcode_t __attribute ((always_inline)) - build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) - re_charset_t *mbcset; - int *range_alloc; - re_bitset_ptr_t sbcset; - bracket_elem_t *start_elem, *end_elem; + build_range_exp (bitset sbcset, re_charset_t *mbcset, + Idx *range_alloc, + bracket_elem_t *start_elem, bracket_elem_t *end_elem) { unsigned int ch; uint32_t start_collseq; @@ -2813,7 +2837,7 @@ parse_bracket_exp (re_string_t *regexp, /* Check start/end collation sequence values. */ if (BE (start_collseq == UINT_MAX || end_collseq == UINT_MAX, 0)) return REG_ECOLLATE; - if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_collseq > end_collseq, 0)) + if (BE ((syntax & REG_NO_EMPTY_RANGES) && start_collseq > end_collseq, 0)) return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2828,12 +2852,11 @@ parse_bracket_exp (re_string_t *regexp, /* There is not enough space, need realloc. */ uint32_t *new_array_start; uint32_t *new_array_end; - int new_nranges; + Idx new_nranges; - /* +1 in case of mbcset->nranges is 0. */ - new_nranges = 2 * mbcset->nranges + 1; - new_array_start = re_realloc (mbcset->range_starts, uint32_t, - new_nranges); + new_nranges = mbcset->nranges; + new_array_start = re_x2realloc (mbcset->range_starts, uint32_t, + &new_nranges); new_array_end = re_realloc (mbcset->range_ends, uint32_t, new_nranges); @@ -2874,11 +2897,8 @@ parse_bracket_exp (re_string_t *regexp, auto inline reg_errcode_t __attribute ((always_inline)) - build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) - re_charset_t *mbcset; - int *coll_sym_alloc; - re_bitset_ptr_t sbcset; - const unsigned char *name; + build_collating_symbol (bitset sbcset, re_charset_t *mbcset, + Idx *coll_sym_alloc, const unsigned char *name) { int32_t elem, idx; size_t name_len = strlen ((const char *) name); @@ -2907,12 +2927,11 @@ parse_bracket_exp (re_string_t *regexp, if (BE (*coll_sym_alloc == mbcset->ncoll_syms, 0)) { /* Not enough, realloc it. */ - /* +1 in case of mbcset->ncoll_syms is 0. */ - int new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; + Idx new_coll_sym_alloc = mbcset->ncoll_syms; /* Use realloc since mbcset->coll_syms is NULL if *alloc == 0. */ - int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t, - new_coll_sym_alloc); + int32_t *new_coll_syms = re_x2realloc (mbcset->coll_syms, int32_t, + &new_coll_sym_alloc); if (BE (new_coll_syms == NULL, 0)) return REG_ESPACE; mbcset->coll_syms = new_coll_syms; @@ -2938,13 +2957,13 @@ parse_bracket_exp (re_string_t *regexp, re_bitset_ptr_t sbcset; #ifdef RE_ENABLE_I18N re_charset_t *mbcset; - int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0; - int equiv_class_alloc = 0, char_class_alloc = 0; + Idx coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0; + Idx equiv_class_alloc = 0, char_class_alloc = 0; #endif /* not RE_ENABLE_I18N */ - int non_match = 0; + bool non_match = false; bin_tree_t *work_tree; int token_len; - int first_round = 1; + bool first_round = true; #ifdef _LIBC collseqmb = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB); @@ -2962,9 +2981,9 @@ parse_bracket_exp (re_string_t *regexp, _NL_COLLATE_SYMB_EXTRAMB); } #endif - sbcset = (re_bitset_ptr_t) calloc (sizeof (unsigned int), BITSET_UINTS); + sbcset = re_calloc (bitset_word, BITSET_WORDS); #ifdef RE_ENABLE_I18N - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + mbcset = re_calloc (re_charset_t, 1); #endif /* RE_ENABLE_I18N */ #ifdef RE_ENABLE_I18N if (BE (sbcset == NULL || mbcset == NULL, 0)) @@ -2987,8 +3006,8 @@ parse_bracket_exp (re_string_t *regexp, #ifdef RE_ENABLE_I18N mbcset->non_match = 1; #endif /* not RE_ENABLE_I18N */ - non_match = 1; - if (syntax & RE_HAT_LISTS_NOT_NEWLINE) + non_match = true; + if (syntax & REG_HAT_LISTS_NOT_NEWLINE) bitset_set (sbcset, '\0'); re_string_skip_bytes (regexp, token_len); /* Skip a token. */ token_len = peek_token_bracket (token, regexp, syntax); @@ -3009,7 +3028,8 @@ parse_bracket_exp (re_string_t *regexp, unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE]; unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE]; reg_errcode_t ret; - int token_len2 = 0, is_range_exp = 0; + int token_len2 = 0; + bool is_range_exp = false; re_token_t token2; start_elem.opr.name = start_name_buf; @@ -3020,7 +3040,7 @@ parse_bracket_exp (re_string_t *regexp, *err = ret; goto parse_bracket_exp_free_return; } - first_round = 0; + first_round = false; /* Get information about the next token. We need it in any case. */ token_len = peek_token_bracket (token, regexp, syntax); @@ -3049,15 +3069,15 @@ parse_bracket_exp (re_string_t *regexp, token->type = CHARACTER; } else - is_range_exp = 1; + is_range_exp = true; } } - if (is_range_exp == 1) + if (is_range_exp == true) { end_elem.opr.name = end_name_buf; ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2, - dfa, syntax, 1); + dfa, syntax, true); if (BE (ret != REG_NOERROR, 0)) { *err = ret; @@ -3095,11 +3115,10 @@ parse_bracket_exp (re_string_t *regexp, { wchar_t *new_mbchars; /* Not enough, realloc it. */ - /* +1 in case of mbcset->nmbchars is 0. */ - mbchar_alloc = 2 * mbcset->nmbchars + 1; + mbchar_alloc = mbcset->nmbchars; /* Use realloc since array is NULL if *alloc == 0. */ - new_mbchars = re_realloc (mbcset->mbchars, wchar_t, - mbchar_alloc); + new_mbchars = re_x2realloc (mbcset->mbchars, wchar_t, + &mbchar_alloc); if (BE (new_mbchars == NULL, 0)) goto parse_bracket_exp_espace; mbcset->mbchars = new_mbchars; @@ -3172,12 +3191,12 @@ parse_bracket_exp (re_string_t *regexp, mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token); if (BE (mbc_tree == NULL, 0)) goto parse_bracket_exp_espace; - for (sbc_idx = 0; sbc_idx < BITSET_UINTS; ++sbc_idx) + for (sbc_idx = 0; sbc_idx < BITSET_WORDS; ++sbc_idx) if (sbcset[sbc_idx]) break; /* If there are no bits set in sbcset, there is no point of having both SIMPLE_BRACKET and COMPLEX_BRACKET. */ - if (sbc_idx < BITSET_UINTS) + if (sbc_idx < BITSET_WORDS) { /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; @@ -3227,7 +3246,7 @@ parse_bracket_exp (re_string_t *regexp, static reg_errcode_t parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token, int token_len, re_dfa_t *dfa, - reg_syntax_t syntax, int accept_hyphen) + reg_syntax_t syntax, bool accept_hyphen) { #ifdef RE_ENABLE_I18N int cur_char_size; @@ -3312,9 +3331,9 @@ parse_bracket_symbol (bracket_elem_t *el is a pointer argument sinse we may update it. */ static reg_errcode_t -build_equiv_class (re_bitset_ptr_t sbcset, +build_equiv_class (bitset sbcset, #ifdef RE_ENABLE_I18N - re_charset_t *mbcset, int *equiv_class_alloc, + re_charset_t *mbcset, Idx *equiv_class_alloc, #endif const unsigned char *name) { @@ -3373,12 +3392,11 @@ build_equiv_class (re_bitset_ptr_t sbcse if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0)) { /* Not enough, realloc it. */ - /* +1 in case of mbcset->nequiv_classes is 0. */ - int new_equiv_class_alloc = 2 * mbcset->nequiv_classes + 1; + Idx new_equiv_class_alloc = mbcset->nequiv_classes; /* Use realloc since the array is NULL if *alloc == 0. */ - int32_t *new_equiv_classes = re_realloc (mbcset->equiv_classes, - int32_t, - new_equiv_class_alloc); + int32_t *new_equiv_classes = re_x2realloc (mbcset->equiv_classes, + int32_t, + &new_equiv_class_alloc); if (BE (new_equiv_classes == NULL, 0)) return REG_ESPACE; mbcset->equiv_classes = new_equiv_classes; @@ -3403,9 +3421,9 @@ build_equiv_class (re_bitset_ptr_t sbcse is a pointer argument sinse we may update it. */ static reg_errcode_t -build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset, +build_charclass (unsigned REG_TRANSLATE_TYPE trans, bitset sbcset, #ifdef RE_ENABLE_I18N - re_charset_t *mbcset, int *char_class_alloc, + re_charset_t *mbcset, Idx *char_class_alloc, #endif const unsigned char *class_name, reg_syntax_t syntax) { @@ -3414,7 +3432,7 @@ build_charclass (unsigned RE_TRANSLATE_T /* In case of REG_ICASE "upper" and "lower" match the both of upper and lower cases. */ - if ((syntax & RE_ICASE) + if ((syntax & REG_IGNORE_CASE) && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0)) name = "alpha"; @@ -3423,11 +3441,10 @@ build_charclass (unsigned RE_TRANSLATE_T if (BE (*char_class_alloc == mbcset->nchar_classes, 0)) { /* Not enough, realloc it. */ - /* +1 in case of mbcset->nchar_classes is 0. */ - int new_char_class_alloc = 2 * mbcset->nchar_classes + 1; + Idx new_char_class_alloc = mbcset->nchar_classes; /* Use realloc since array is NULL if *alloc == 0. */ - wctype_t *new_char_classes = re_realloc (mbcset->char_classes, wctype_t, - new_char_class_alloc); + wctype_t *new_char_classes = re_x2realloc (mbcset->char_classes, wctype_t, + &new_char_class_alloc); if (BE (new_char_classes == NULL, 0)) return REG_ESPACE; mbcset->char_classes = new_char_classes; @@ -3477,23 +3494,23 @@ build_charclass (unsigned RE_TRANSLATE_T } static bin_tree_t * -build_charclass_op (re_dfa_t *dfa, unsigned RE_TRANSLATE_TYPE trans, +build_charclass_op (re_dfa_t *dfa, unsigned REG_TRANSLATE_TYPE trans, const unsigned char *class_name, const unsigned char *extra, - int non_match, reg_errcode_t *err) + bool non_match, reg_errcode_t *err) { re_bitset_ptr_t sbcset; #ifdef RE_ENABLE_I18N re_charset_t *mbcset; - int alloc = 0; + Idx alloc = 0; #endif /* not RE_ENABLE_I18N */ reg_errcode_t ret; re_token_t br_token; bin_tree_t *tree; - sbcset = (re_bitset_ptr_t) calloc (sizeof (unsigned int), BITSET_UINTS); + sbcset = re_calloc (bitset_word, BITSET_WORDS); #ifdef RE_ENABLE_I18N - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + mbcset = re_calloc (re_charset_t, 1); #endif /* RE_ENABLE_I18N */ #ifdef RE_ENABLE_I18N @@ -3510,7 +3527,7 @@ build_charclass_op (re_dfa_t *dfa, unsig { #ifdef RE_ENABLE_I18N /* - if (syntax & RE_HAT_LISTS_NOT_NEWLINE) + if (syntax & REG_HAT_LISTS_NOT_NEWLINE) bitset_set(cset->sbcset, '\0'); */ mbcset->non_match = 1; @@ -3590,25 +3607,27 @@ build_charclass_op (re_dfa_t *dfa, unsig /* This is intended for the expressions like "a{1,3}". Fetch a number from `input', and return the number. - Return -1, if the number field is empty like "{,1}". - Return -2, If an error is occured. */ + Return REG_MISSING if the number field is empty like "{,1}". + Return REG_ERROR if an error occurred. */ -static int +static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) { - int num = -1; + Idx num = REG_MISSING; unsigned char c; while (1) { fetch_token (token, input, syntax); c = token->opr.c; if (BE (token->type == END_OF_RE, 0)) - return -2; + return REG_ERROR; if (token->type == OP_CLOSE_DUP_NUM || c == ',') break; - num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) - ? -2 : ((num == -1) ? c - '0' : num * 10 + c - '0')); - num = (num > RE_DUP_MAX) ? -2 : num; + num = ((token->type != CHARACTER || c < '0' || '9' < c + || num == REG_ERROR) + ? REG_ERROR + : ((num == REG_MISSING) ? c - '0' : num * 10 + c - '0')); + num = (num > REG_DUP_MAX) ? REG_ERROR : num; } return num; } @@ -3667,7 +3686,7 @@ create_token_tree (re_dfa_t *dfa, bin_tr tree->token.opt_subexp = 0; tree->first = NULL; tree->next = NULL; - tree->node_idx = -1; + tree->node_idx = REG_MISSING; if (left != NULL) left->parent = tree; @@ -3682,7 +3701,7 @@ create_token_tree (re_dfa_t *dfa, bin_tr static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node) { - int idx = (int) (long) extra; + Idx idx = (Idx) (long) extra; if (node->token.type == SUBEXP && node->token.opr.idx == idx) node->token.opt_subexp = 1; Index: lib/regex.c =================================================================== RCS file: /fetish/cu/lib/regex.c,v retrieving revision 1.88 diff -p -u -r1.88 regex.c --- lib/regex.c 23 Aug 2005 19:41:09 -0000 1.88 +++ lib/regex.c 9 Sep 2005 20:58:16 -0000 @@ -21,30 +21,6 @@ #include "config.h" #endif -#ifdef _AIX -#pragma alloca -#else -# ifndef allocax /* predefined by HP cc +Olibcalls */ -# ifdef __GNUC__ -# define alloca(size) __builtin_alloca (size) -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef __hpux - void *alloca (); -# else -# if !defined __OS2__ && !defined WIN32 - char *alloca (); -# else -# include /* OS/2 defines alloca in here */ -# endif -# endif -# endif -# endif -# endif -#endif - #ifdef _LIBC /* We have to keep the namespace clean. */ # define regfree(preg) __regfree (preg) @@ -70,10 +46,6 @@ # include "../locale/localeinfo.h" #endif -/* POSIX says that must be included (by the caller) before - . */ -#include - /* On some systems, limits.h sets RE_DUP_MAX to a lower value than GNU regex allows. Include it before , which correctly #undefs RE_DUP_MAX and sets it to the right value. */ Index: lib/regex.h =================================================================== RCS file: /fetish/cu/lib/regex.h,v retrieving revision 1.24 diff -p -u -r1.24 regex.h --- lib/regex.h 23 Aug 2005 19:41:09 -0000 1.24 +++ lib/regex.h 9 Sep 2005 20:58:16 -0000 @@ -28,15 +28,61 @@ extern "C" { #endif -/* POSIX says that must be included (by the caller) before - . */ +/* Define _REGEX_SOURCE to get definitions that are incompatible with + POSIX. */ +#if (!defined _REGEX_SOURCE \ + && (defined _GNU_SOURCE \ + || (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \ + && !defined _XOPEN_SOURCE))) +# define _REGEX_SOURCE 1 +#endif -#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS +#if defined _REGEX_SOURCE && defined VMS /* VMS doesn't have `size_t' in , even though POSIX says it should be there. */ # include #endif +#ifdef _REGEX_LARGE_OFFSETS + +/* Use types and values that are wide enough to represent signed and + unsigned byte offsets in memory. This currently works only when + the regex code is used outside of the GNU C library; it is not yet + supported within glibc itself, and glibc users should not define + _REGEX_LARGE_OFFSETS. */ + +/* The type of the offset of a byte within a string. + For historical reasons POSIX 1003.1-2004 requires that regoff_t be + at least as wide as off_t. This is a bit odd (and many common + POSIX platforms set it to the more-sensible ssize_t) but we might + as well conform. We don't know of any hosts where ssize_t is wider + than off_t, so off_t is safe. */ +typedef off_t regoff_t; + +/* The type of nonnegative object indexes. Traditionally, GNU regex + uses 'int' for these. Code that uses __re_idx_t should work + regardless of whether the type is signed. */ +typedef size_t __re_idx_t; + +/* The type of object sizes. */ +typedef size_t __re_size_t; + +/* The type of object sizes, in places where the traditional code + uses unsigned long int. */ +typedef size_t __re_long_size_t; + +#else + +/* Use types that are binary-compatible with the traditional GNU regex + implementation, which mishandles strings longer than INT_MAX. */ + +typedef int regoff_t; +typedef int __re_idx_t; +typedef unsigned int __re_size_t; +typedef unsigned long int __re_long_size_t; + +#endif + /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two @@ -53,18 +99,18 @@ typedef unsigned long int reg_syntax_t; /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ -#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) +#define REG_BACKSLASH_ESCAPE_IN_LISTS 1ul /* If this bit is not set, then + and ? are operators, and \+ and \? are literals. If set, then \+ and \? are operators and + and ? are literals. */ -#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) +#define REG_BK_PLUS_QM (1ul << 1) /* If this bit is set, then character classes are supported. They are: [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. If not set, then character classes are not supported. */ -#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) +#define REG_CHAR_CLASSES (1ul << 2) /* If this bit is set, then ^ and $ are always anchors (outside bracket expressions, of course). @@ -74,11 +120,11 @@ typedef unsigned long int reg_syntax_t; $ is an anchor if it is at the end of a regular expression, or before a close-group or an alternation operator. - This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because + This bit could be (re)combined with REG_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. We already implemented a previous draft which made those constructs invalid, though, so we haven't changed the code back. */ -#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) +#define REG_CONTEXT_INDEP_ANCHORS (1ul << 3) /* If this bit is set, then special characters are always special regardless of where they are in the pattern. @@ -86,70 +132,70 @@ typedef unsigned long int reg_syntax_t; some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ -#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) +#define REG_CONTEXT_INDEP_OPS (1ul << 4) /* If this bit is set, then *, +, ?, and { cannot be first in an re or immediately after an alternation or begin-group operator. */ -#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) +#define REG_CONTEXT_INVALID_OPS (1ul << 5) /* If this bit is set, then . matches newline. If not set, then it doesn't. */ -#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) +#define REG_DOT_NEWLINE (1ul << 6) /* If this bit is set, then . doesn't match NUL. If not set, then it does. */ -#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) +#define REG_DOT_NOT_NULL (1ul << 7) /* If this bit is set, nonmatching lists [^...] do not match newline. If not set, they do. */ -#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) +#define REG_HAT_LISTS_NOT_NEWLINE (1ul << 8) /* If this bit is set, either \{...\} or {...} defines an - interval, depending on RE_NO_BK_BRACES. + interval, depending on REG_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ -#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) +#define REG_INTERVALS (1ul << 9) /* If this bit is set, +, ? and | aren't recognized as operators. If not set, they are. */ -#define RE_LIMITED_OPS (RE_INTERVALS << 1) +#define REG_LIMITED_OPS (1ul << 10) /* If this bit is set, newline is an alternation operator. If not set, newline is literal. */ -#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) +#define REG_NEWLINE_ALT (1ul << 11) /* If this bit is set, then `{...}' defines an interval, and \{ and \} are literals. If not set, then `\{...\}' defines an interval. */ -#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) +#define REG_NO_BK_BRACES (1ul << 12) /* If this bit is set, (...) defines a group, and \( and \) are literals. If not set, \(...\) defines a group, and ( and ) are literals. */ -#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) +#define REG_NO_BK_PARENS (1ul << 13) /* If this bit is set, then \ matches . If not set, then \ is a back-reference. */ -#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) +#define REG_NO_BK_REFS (1ul << 14) /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ -#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) +#define REG_NO_BK_VBAR (1ul << 15) /* If this bit is set, then an ending range point collating higher than the starting range point, as in [z-a], is invalid. If not set, the containing range is empty and does not match any string. */ -#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) +#define REG_NO_EMPTY_RANGES (1ul << 16) /* If this bit is set, then an unmatched ) is ordinary. If not set, then an unmatched ) is invalid. */ -#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) +#define REG_UNMATCHED_RIGHT_PAREN_ORD (1ul << 17) /* If this bit is set, succeed as soon as we match the whole pattern, without further backtracking. */ -#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) +#define REG_NO_POSIX_BACKTRACKING (1ul << 18) /* If this bit is set, do not process the GNU regex operators. If not set, then the GNU regex operators are recognized. */ -#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) +#define REG_NO_GNU_OPS (1ul << 19) /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. @@ -157,29 +203,29 @@ typedef unsigned long int reg_syntax_t; We define this bit always, so that all that's needed to turn on debugging is to recompile regex.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ -#define RE_DEBUG (RE_NO_GNU_OPS << 1) +#define REG_DEBUG (1ul << 20) /* If this bit is set, a syntactically invalid interval is treated as a string of ordinary characters. For example, the ERE 'a{1' is treated as 'a\{1'. */ -#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) +#define REG_INVALID_INTERVAL_ORD (1ul << 21) /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ -#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) +#define REG_IGNORE_CASE (1ul << 22) -/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only +/* This bit is used internally like REG_CONTEXT_INDEP_ANCHORS but only for ^, because it is difficult to scan the regex backwards to find whether ^ should be special. */ -#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) +#define REG_CARET_ANCHORS_HERE (1ul << 23) /* If this bit is set, then \{ cannot be first in an bre or immediately after an alternation or begin-group operator. */ -#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) +#define REG_CONTEXT_INVALID_DUP (1ul << 24) /* If this bit is set, then no_sub will be set to 1 during re_compile_pattern. */ -#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) +#define REG_NO_SUB (1ul << 25) /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is @@ -191,81 +237,78 @@ extern reg_syntax_t re_syntax_options; (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ /* [[[begin syntaxes]]] */ -#define RE_SYNTAX_EMACS 0 +#define REG_SYNTAX_EMACS 0 -#define RE_SYNTAX_AWK \ - (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ - | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ - | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) - -#define RE_SYNTAX_GNU_AWK \ - ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ - & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \ - | RE_CONTEXT_INVALID_OPS )) - -#define RE_SYNTAX_POSIX_AWK \ - (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ - | RE_INTERVALS | RE_NO_GNU_OPS) - -#define RE_SYNTAX_GREP \ - (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ - | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ - | RE_NEWLINE_ALT) - -#define RE_SYNTAX_EGREP \ - (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ - | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ - | RE_NO_BK_VBAR) - -#define RE_SYNTAX_POSIX_EGREP \ - (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ - | RE_INVALID_INTERVAL_ORD) +#define REG_SYNTAX_AWK \ + (REG_BACKSLASH_ESCAPE_IN_LISTS | REG_DOT_NOT_NULL \ + | REG_NO_BK_PARENS | REG_NO_BK_REFS \ + | REG_NO_BK_VBAR | REG_NO_EMPTY_RANGES \ + | REG_DOT_NEWLINE | REG_CONTEXT_INDEP_ANCHORS \ + | REG_UNMATCHED_RIGHT_PAREN_ORD | REG_NO_GNU_OPS) + +#define REG_SYNTAX_GNU_AWK \ + ((REG_SYNTAX_POSIX_EXTENDED | REG_BACKSLASH_ESCAPE_IN_LISTS \ + | REG_DEBUG) \ + & ~(REG_DOT_NOT_NULL | REG_INTERVALS | REG_CONTEXT_INDEP_OPS \ + | REG_CONTEXT_INVALID_OPS )) + +#define REG_SYNTAX_POSIX_AWK \ + (REG_SYNTAX_POSIX_EXTENDED | REG_BACKSLASH_ESCAPE_IN_LISTS \ + | REG_INTERVALS | REG_NO_GNU_OPS) + +#define REG_SYNTAX_GREP \ + (REG_BK_PLUS_QM | REG_CHAR_CLASSES \ + | REG_HAT_LISTS_NOT_NEWLINE | REG_INTERVALS \ + | REG_NEWLINE_ALT) + +#define REG_SYNTAX_EGREP \ + (REG_CHAR_CLASSES | REG_CONTEXT_INDEP_ANCHORS \ + | REG_CONTEXT_INDEP_OPS | REG_HAT_LISTS_NOT_NEWLINE \ + | REG_NEWLINE_ALT | REG_NO_BK_PARENS \ + | REG_NO_BK_VBAR) + +#define REG_SYNTAX_POSIX_EGREP \ + (REG_SYNTAX_EGREP | REG_INTERVALS | REG_NO_BK_BRACES \ + | REG_INVALID_INTERVAL_ORD) /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ -#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC +#define REG_SYNTAX_ED REG_SYNTAX_POSIX_BASIC -#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC +#define REG_SYNTAX_SED REG_SYNTAX_POSIX_BASIC /* Syntax bits common to both basic and extended POSIX regex syntax. */ -#define _RE_SYNTAX_POSIX_COMMON \ - (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ - | RE_INTERVALS | RE_NO_EMPTY_RANGES) +#define _REG_SYNTAX_POSIX_COMMON \ + (REG_CHAR_CLASSES | REG_DOT_NEWLINE | REG_DOT_NOT_NULL \ + | REG_INTERVALS | REG_NO_EMPTY_RANGES) -#define RE_SYNTAX_POSIX_BASIC \ - (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) +#define REG_SYNTAX_POSIX_BASIC \ + (_REG_SYNTAX_POSIX_COMMON | REG_BK_PLUS_QM | REG_CONTEXT_INVALID_DUP) -/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes - RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this +/* Differs from ..._POSIX_BASIC only in that REG_BK_PLUS_QM becomes + REG_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this isn't minimal, since other operators, such as \`, aren't disabled. */ -#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ - (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) +#define REG_SYNTAX_POSIX_MINIMAL_BASIC \ + (_REG_SYNTAX_POSIX_COMMON | REG_LIMITED_OPS) -#define RE_SYNTAX_POSIX_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ - | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) - -/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is - removed and RE_NO_BK_REFS is added. */ -#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) +#define REG_SYNTAX_POSIX_EXTENDED \ + (_REG_SYNTAX_POSIX_COMMON | REG_CONTEXT_INDEP_ANCHORS \ + | REG_CONTEXT_INDEP_OPS | REG_NO_BK_BRACES \ + | REG_NO_BK_PARENS | REG_NO_BK_VBAR \ + | REG_CONTEXT_INVALID_OPS | REG_UNMATCHED_RIGHT_PAREN_ORD) + +/* Differs from ..._POSIX_EXTENDED in that REG_CONTEXT_INDEP_OPS is + removed and REG_NO_BK_REFS is added. */ +#define REG_SYNTAX_POSIX_MINIMAL_EXTENDED \ + (_REG_SYNTAX_POSIX_COMMON | REG_CONTEXT_INDEP_ANCHORS \ + | REG_CONTEXT_INVALID_OPS | REG_NO_BK_BRACES \ + | REG_NO_BK_PARENS | REG_NO_BK_REFS \ + | REG_NO_BK_VBAR | REG_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ -/* Maximum number of duplicates an interval can allow. Some systems - (erroneously) define this in other header files, but we want our - value, so remove any previous define. */ -#ifdef RE_DUP_MAX -# undef RE_DUP_MAX -#endif -/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ -#define RE_DUP_MAX (0x7fff) +/* Maximum number of duplicates an interval can allow. This is + distinct from RE_DUP_MAX, to conform to POSIX name space rules and + to avoid collisions with . */ +#define REG_DUP_MAX 32767 /* POSIX `cflags' bits (i.e., information for `regcomp'). */ @@ -276,16 +319,16 @@ extern reg_syntax_t re_syntax_options; /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ -#define REG_ICASE (REG_EXTENDED << 1) +#define REG_ICASE (1 << 1) /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ -#define REG_NEWLINE (REG_ICASE << 1) +#define REG_NEWLINE (1 << 2) /* If this bit is set, then report only success or fail in regexec. If not set, then returns differ between not matching and errors. */ -#define REG_NOSUB (REG_NEWLINE << 1) +#define REG_NOSUB (1 << 3) /* POSIX `eflags' bits (i.e., information for regexec). */ @@ -306,74 +349,131 @@ extern reg_syntax_t re_syntax_options; /* If any error codes are removed, changed, or added, update the - `re_error_msg' table in regex.c. */ + `__re_error_msgid' table in regcomp.c. */ + typedef enum { -#ifdef _XOPEN_SOURCE - REG_ENOSYS = -1, /* This will never happen for this implementation. */ -#endif + _REG_ENOSYS = -1, /* This will never happen for this implementation. */ +#define REG_ENOSYS _REG_ENOSYS + + _REG_NOERROR, /* Success. */ +#define REG_NOERROR _REG_NOERROR - REG_NOERROR = 0, /* Success. */ - REG_NOMATCH, /* Didn't find a match (for regexec). */ + _REG_NOMATCH, /* Didn't find a match (for regexec). */ +#define REG_NOMATCH _REG_NOMATCH /* POSIX regcomp return error codes. (In the order listed in the standard.) */ - REG_BADPAT, /* Invalid pattern. */ - REG_ECOLLATE, /* Inalid collating element. */ - REG_ECTYPE, /* Invalid character class name. */ - REG_EESCAPE, /* Trailing backslash. */ - REG_ESUBREG, /* Invalid back reference. */ - REG_EBRACK, /* Unmatched left bracket. */ - REG_EPAREN, /* Parenthesis imbalance. */ - REG_EBRACE, /* Unmatched \{. */ - REG_BADBR, /* Invalid contents of \{\}. */ - REG_ERANGE, /* Invalid range end. */ - REG_ESPACE, /* Ran out of memory. */ - REG_BADRPT, /* No preceding re for repetition op. */ + + _REG_BADPAT, /* Invalid pattern. */ +#define REG_BADPAT _REG_BADPAT + + _REG_ECOLLATE, /* Inalid collating element. */ +#define REG_ECOLLATE _REG_ECOLLATE + + _REG_ECTYPE, /* Invalid character class name. */ +#define REG_ECTYPE _REG_ECTYPE + + _REG_EESCAPE, /* Trailing backslash. */ +#define REG_EESCAPE _REG_EESCAPE + + _REG_ESUBREG, /* Invalid back reference. */ +#define REG_ESUBREG _REG_ESUBREG + + _REG_EBRACK, /* Unmatched left bracket. */ +#define REG_EBRACK _REG_EBRACK + + _REG_EPAREN, /* Parenthesis imbalance. */ +#define REG_EPAREN _REG_EPAREN + + _REG_EBRACE, /* Unmatched \{. */ +#define REG_EBRACE _REG_EBRACE + + _REG_BADBR, /* Invalid contents of \{\}. */ +#define REG_BADBR _REG_BADBR + + _REG_ERANGE, /* Invalid range end. */ +#define REG_ERANGE _REG_ERANGE + + _REG_ESPACE, /* Ran out of memory. */ +#define REG_ESPACE _REG_ESPACE + + _REG_BADRPT, /* No preceding re for repetition op. */ +#define REG_BADRPT _REG_BADRPT /* Error codes we've added. */ - REG_EEND, /* Premature end. */ - REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ - REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ + + _REG_EEND, /* Premature end. */ +#define REG_EEND _REG_EEND + + _REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ +#define REG_ESIZE _REG_ESIZE + + _REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ +#define REG_ERPAREN _REG_ERPAREN + } reg_errcode_t; +/* In the traditional GNU implementation, regex.h defined member names + like `buffer' that POSIX does not allow. These members now have + names with leading `re_' (e.g., `re_buffer'). Support the old + names only if _REGEX_SOURCE is defined. New programs should use + the new names. */ +#ifdef _REGEX_SOURCE +# define _REG_RE_NAME(id) id +# define _REG_RM_NAME(id) id +#else +# define _REG_RE_NAME(id) re_##id +# define _REG_RM_NAME(id) rm_##id +#endif + +/* The user can specify the type of the re_translate member by + defining the macro REG_TRANSLATE_TYPE. In the traditional GNU + implementation, this macro was named RE_TRANSLATE_TYPE, but POSIX + does not allow this. Support the old name only if _REGEX_SOURCE + and if the new name is not defined. New programs should use the new + name. */ +#ifndef REG_TRANSLATE_TYPE +# if defined _REGEX_SOURCE && defined RE_TRANSLATE_TYPE +# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE +# else +# define REG_TRANSLATE_TYPE char * +# endif +#endif + /* This data structure represents a compiled pattern. Before calling - the pattern compiler, the fields `buffer', `allocated', `fastmap', - `translate', and `no_sub' can be set. After the pattern has been + the pattern compiler), the fields `re_buffer', `re_allocated', `re_fastmap', + `re_translate', and `re_no_sub' can be set. After the pattern has been compiled, the `re_nsub' field is available. All other fields are private to the regex routines. */ -#ifndef RE_TRANSLATE_TYPE -# define RE_TRANSLATE_TYPE char * -#endif - struct re_pattern_buffer { /* [[[begin pattern_buffer]]] */ /* Space that holds the compiled pattern. It is declared as `unsigned char *' because its elements are sometimes used as array indexes. */ - unsigned char *buffer; + unsigned char *_REG_RE_NAME (buffer); - /* Number of bytes to which `buffer' points. */ - unsigned long int allocated; + /* Number of bytes to which `re_buffer' points. */ + __re_long_size_t _REG_RE_NAME (allocated); - /* Number of bytes actually used in `buffer'. */ - unsigned long int used; + /* Number of bytes actually used in `re_buffer'. */ + __re_long_size_t _REG_RE_NAME (used); /* Syntax setting with which the pattern was compiled. */ - reg_syntax_t syntax; + reg_syntax_t _REG_RE_NAME (syntax); /* Pointer to a fastmap, if any, otherwise zero. re_search uses the fastmap, if there is one, to skip over impossible starting points for matches. */ - char *fastmap; + char *_REG_RE_NAME (fastmap); /* Either a translate table to apply to all characters before comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ - RE_TRANSLATE_TYPE translate; + REG_TRANSLATE_TYPE _REG_RE_NAME (translate); /* Number of subexpressions found by the compiler. */ size_t re_nsub; @@ -383,59 +483,55 @@ struct re_pattern_buffer whether or not we should use the fastmap, so we don't set this absolutely perfectly; see `re_compile_fastmap' (the `duplicate' case). */ - unsigned can_be_null : 1; + unsigned int _REG_RE_NAME (can_be_null) : 1; - /* If REGS_UNALLOCATED, allocate space in the `regs' structure - for `max (RE_NREGS, re_nsub + 1)' groups. - If REGS_REALLOCATE, reallocate space if necessary. - If REGS_FIXED, use what's there. */ -#define REGS_UNALLOCATED 0 -#define REGS_REALLOCATE 1 -#define REGS_FIXED 2 - unsigned regs_allocated : 2; + /* If REG_UNALLOCATED, allocate space in the `regs' structure + for `max (REG_NREGS, re_nsub + 1)' groups. + If REG_REALLOCATE, reallocate space if necessary. + If REG_FIXED, use what's there. */ +#define REG_UNALLOCATED 0 +#define REG_REALLOCATE 1 +#define REG_FIXED 2 + unsigned int _REG_RE_NAME (regs_allocated) : 2; /* Set to zero when `regex_compile' compiles a pattern; set to one by `re_compile_fastmap' if it updates the fastmap. */ - unsigned fastmap_accurate : 1; + unsigned int _REG_RE_NAME (fastmap_accurate) : 1; /* If set, `re_match_2' does not return information about subexpressions. */ - unsigned no_sub : 1; + unsigned int _REG_RE_NAME (no_sub) : 1; /* If set, a beginning-of-line anchor doesn't match at the beginning of the string. */ - unsigned not_bol : 1; + unsigned int _REG_RE_NAME (not_bol) : 1; /* Similarly for an end-of-line anchor. */ - unsigned not_eol : 1; + unsigned int _REG_RE_NAME (not_eol) : 1; /* If true, an anchor at a newline matches. */ - unsigned newline_anchor : 1; + unsigned int _REG_RE_NAME (newline_anchor) : 1; /* [[[end pattern_buffer]]] */ }; typedef struct re_pattern_buffer regex_t; -/* Type for byte offsets within the string. POSIX mandates this. */ -typedef int regoff_t; - - /* This is the structure we store register match data in. See regex.texinfo for a full description of what registers match. */ struct re_registers { - unsigned num_regs; - regoff_t *start; - regoff_t *end; + __re_size_t _REG_RM_NAME (num_regs); + regoff_t *_REG_RM_NAME (start); + regoff_t *_REG_RM_NAME (end); }; -/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, +/* If `regs_allocated' is REG_UNALLOCATED in the pattern buffer, `re_match_2' returns information about at least this many registers the first time a `regs' structure is passed. */ -#ifndef RE_NREGS -# define RE_NREGS 30 +#ifndef REG_NREGS +# define REG_NREGS 30 #endif @@ -452,49 +548,55 @@ typedef struct /* Sets the current default syntax to SYNTAX, and return the old syntax. You can also simply assign to the `re_syntax_options' variable. */ -extern reg_syntax_t re_set_syntax (reg_syntax_t syntax); +extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); /* Compile the regular expression PATTERN, with length LENGTH and syntax given by the global `re_syntax_options', into the buffer BUFFER. Return NULL if successful, and an error string if not. */ -extern const char *re_compile_pattern (const char *pattern, size_t length, - struct re_pattern_buffer *buffer); +extern const char *re_compile_pattern (const char *__pattern, size_t __length, + struct re_pattern_buffer *__buffer); /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ -extern int re_compile_fastmap (struct re_pattern_buffer *buffer); +extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); /* Search in the string STRING (with length LENGTH) for the pattern compiled into BUFFER. Start searching at position START, for RANGE characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register - information in REGS (if REGS and BUFFER->no_sub are nonzero). */ -extern int re_search (struct re_pattern_buffer *buffer, const char *string, - int length, int start, int range, - struct re_registers *regs); + information in REGS (if REGS and BUFFER->re_no_sub are nonzero). */ +extern regoff_t re_search (struct re_pattern_buffer *__buffer, + const char *__string, __re_idx_t __length, + __re_idx_t __start, regoff_t __range, + struct re_registers *__regs); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ -extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, - int stop); +extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, + const char *__string1, __re_idx_t __length1, + const char *__string2, __re_idx_t __length2, + __re_idx_t __start, regoff_t __range, + struct re_registers *__regs, + __re_idx_t __stop); /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ -extern int re_match (struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs); +extern regoff_t re_match (struct re_pattern_buffer *__buffer, + const char *__string, __re_idx_t __length, + __re_idx_t __start, struct re_registers *__regs); /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop); +extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, + const char *__string1, __re_idx_t __length1, + const char *__string2, __re_idx_t __length2, + __re_idx_t __start, struct re_registers *__regs, + __re_idx_t __stop); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -509,9 +611,10 @@ extern int re_match_2 (struct re_pattern Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ -extern void re_set_registers (struct re_pattern_buffer *buffer, - struct re_registers *regs, unsigned num_regs, - regoff_t *starts, regoff_t *ends); +extern void re_set_registers (struct re_pattern_buffer *__buffer, + struct re_registers *__regs, + __re_size_t __num_regs, + regoff_t *__starts, regoff_t *__ends); #if defined _REGEX_RE_COMP || defined _LIBC # ifndef _CRAY @@ -551,12 +654,106 @@ extern int regexec (const regex_t *__res regmatch_t __pmatch[__restrict_arr], int __eflags); -extern size_t regerror (int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size); +extern size_t regerror (int __errcode, const regex_t *__restrict __preg, + char *__restrict __errbuf, size_t __errbuf_size); extern void regfree (regex_t *__preg); +#ifdef _REGEX_SOURCE + +/* Define the POSIX-compatible member names in terms of the + incompatible (and deprecated) names established by _REG_RE_NAME. + New programs should use the re_* names. */ + +# define re_allocated allocated +# define re_buffer buffer +# define re_can_be_null can_be_null +# define re_fastmap fastmap +# define re_fastmap_accurate fastmap_accurate +# define re_newline_anchor newline_anchor +# define re_no_sub no_sub +# define re_not_bol not_bol +# define re_not_eol not_eol +# define re_regs_allocated regs_allocated +# define re_syntax syntax +# define re_translate translate +# define re_used used + +/* Similarly for _REG_RM_NAME. */ + +# define rm_end end +# define rm_num_regs num_regs +# define rm_start start + +/* Undef RE_DUP_MAX first, in case the user has already included a + with an incompatible definition. + + On GNU systems, the most common spelling for RE_DUP_MAX's value in + is (0x7ffff), so define RE_DUP_MAX to that, not to + REG_DUP_MAX. This avoid some duplicate-macro-definition warnings + with programs that include after this file. + + New programs should not assume that regex.h defines RE_DUP_MAX; to + get the value of RE_DUP_MAX, they should instead include + and possibly invoke the sysconf function. */ + +# undef RE_DUP_MAX +# define RE_DUP_MAX (0x7fff) + +/* Define the following symbols for backward source compatibility. + These symbols violate the POSIX name space rules, and new programs + should avoid them. */ + +# define REGS_FIXED REG_FIXED +# define REGS_REALLOCATE REG_REALLOCATE +# define REGS_UNALLOCATED REG_UNALLOCATED +# define RE_BACKSLASH_ESCAPE_IN_LISTS REG_BACKSLASH_ESCAPE_IN_LISTS +# define RE_BK_PLUS_QM REG_BK_PLUS_QM +# define RE_CARET_ANCHORS_HERE REG_CARET_ANCHORS_HERE +# define RE_CHAR_CLASSES REG_CHAR_CLASSES +# define RE_CONTEXT_INDEP_ANCHORS REG_CONTEXT_INDEP_ANCHORS +# define RE_CONTEXT_INDEP_OPS REG_CONTEXT_INDEP_OPS +# define RE_CONTEXT_INVALID_DUP REG_CONTEXT_INVALID_DUP +# define RE_CONTEXT_INVALID_OPS REG_CONTEXT_INVALID_OPS +# define RE_DEBUG REG_DEBUG +# define RE_DOT_NEWLINE REG_DOT_NEWLINE +# define RE_DOT_NOT_NULL REG_DOT_NOT_NULL +# define RE_HAT_LISTS_NOT_NEWLINE REG_HAT_LISTS_NOT_NEWLINE +# define RE_ICASE REG_IGNORE_CASE /* avoid collision with REG_ICASE */ +# define RE_INTERVALS REG_INTERVALS +# define RE_INVALID_INTERVAL_ORD REG_INVALID_INTERVAL_ORD +# define RE_LIMITED_OPS REG_LIMITED_OPS +# define RE_NEWLINE_ALT REG_NEWLINE_ALT +# define RE_NO_BK_BRACES REG_NO_BK_BRACES +# define RE_NO_BK_PARENS REG_NO_BK_PARENS +# define RE_NO_BK_REFS REG_NO_BK_REFS +# define RE_NO_BK_VBAR REG_NO_BK_VBAR +# define RE_NO_EMPTY_RANGES REG_NO_EMPTY_RANGES +# define RE_NO_GNU_OPS REG_NO_GNU_OPS +# define RE_NO_POSIX_BACKTRACKING REG_NO_POSIX_BACKTRACKING +# define RE_NO_SUB REG_NO_SUB +# define RE_NREGS REG_NREGS +# define RE_SYNTAX_AWK REG_SYNTAX_AWK +# define RE_SYNTAX_ED REG_SYNTAX_ED +# define RE_SYNTAX_EGREP REG_SYNTAX_EGREP +# define RE_SYNTAX_EMACS REG_SYNTAX_EMACS +# define RE_SYNTAX_GNU_AWK REG_SYNTAX_GNU_AWK +# define RE_SYNTAX_GREP REG_SYNTAX_GREP +# define RE_SYNTAX_POSIX_AWK REG_SYNTAX_POSIX_AWK +# define RE_SYNTAX_POSIX_BASIC REG_SYNTAX_POSIX_BASIC +# define RE_SYNTAX_POSIX_EGREP REG_SYNTAX_POSIX_EGREP +# define RE_SYNTAX_POSIX_EXTENDED REG_SYNTAX_POSIX_EXTENDED +# define RE_SYNTAX_POSIX_MINIMAL_BASIC REG_SYNTAX_POSIX_MINIMAL_BASIC +# define RE_SYNTAX_POSIX_MINIMAL_EXTENDED REG_SYNTAX_POSIX_MINIMAL_EXTENDED +# define RE_SYNTAX_SED REG_SYNTAX_SED +# define RE_UNMATCHED_RIGHT_PAREN_ORD REG_UNMATCHED_RIGHT_PAREN_ORD +# ifndef RE_TRANSLATE_TYPE +# define RE_TRANSLATE_TYPE REG_TRANSLATE_TYPE +# endif + +#endif /* defined _REGEX_SOURCE */ + #ifdef __cplusplus } #endif /* C++ */ Index: lib/regex_internal.c =================================================================== RCS file: /fetish/cu/lib/regex_internal.c,v retrieving revision 1.3 diff -p -u -r1.3 regex_internal.c --- lib/regex_internal.c 23 Aug 2005 19:41:09 -0000 1.3 +++ lib/regex_internal.c 9 Sep 2005 20:58:16 -0000 @@ -17,17 +17,17 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -static void re_string_construct_common (const char *str, int len, +static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, - RE_TRANSLATE_TYPE trans, int icase, + REG_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) internal_function; -static re_dfastate_t *create_ci_newstate (re_dfa_t *dfa, +static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, - unsigned int hash) internal_function; -static re_dfastate_t *create_cd_newstate (re_dfa_t *dfa, + re_hashval_t hash) internal_function; +static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, - unsigned int hash) internal_function; + re_hashval_t hash) internal_function; /* Functions for string operation. */ @@ -36,11 +36,11 @@ static re_dfastate_t *create_cd_newstate static reg_errcode_t internal_function -re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len, - RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa) +re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len, + REG_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { reg_errcode_t ret; - int init_buf_len; + Idx init_buf_len; /* Ensure at least one character fits into the buffers. */ if (init_len < dfa->mb_cur_max) @@ -64,8 +64,8 @@ re_string_allocate (re_string_t *pstr, c static reg_errcode_t internal_function -re_string_construct (re_string_t *pstr, const char *str, int len, - RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa) +re_string_construct (re_string_t *pstr, const char *str, Idx len, + REG_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { reg_errcode_t ret; memset (pstr, '\0', sizeof (re_string_t)); @@ -127,18 +127,18 @@ re_string_construct (re_string_t *pstr, static reg_errcode_t internal_function -re_string_realloc_buffers (re_string_t *pstr, int new_buf_len) +re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) { #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { - wint_t *new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len); + wint_t *new_wcs = re_xrealloc (pstr->wcs, wint_t, new_buf_len); if (BE (new_wcs == NULL, 0)) return REG_ESPACE; pstr->wcs = new_wcs; if (pstr->offsets != NULL) { - int *new_offsets = re_realloc (pstr->offsets, int, new_buf_len); + Idx *new_offsets = re_xrealloc (pstr->offsets, Idx, new_buf_len); if (BE (new_offsets == NULL, 0)) return REG_ESPACE; pstr->offsets = new_offsets; @@ -160,15 +160,15 @@ re_string_realloc_buffers (re_string_t * static void internal_function -re_string_construct_common (const char *str, int len, re_string_t *pstr, - RE_TRANSLATE_TYPE trans, int icase, +re_string_construct_common (const char *str, Idx len, re_string_t *pstr, + REG_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { pstr->raw_mbs = (const unsigned char *) str; pstr->len = len; pstr->raw_len = len; - pstr->trans = (unsigned RE_TRANSLATE_TYPE) trans; - pstr->icase = icase ? 1 : 0; + pstr->trans = (unsigned REG_TRANSLATE_TYPE) trans; + pstr->icase = icase; pstr->mbs_allocated = (trans != NULL || icase); pstr->mb_cur_max = dfa->mb_cur_max; pstr->is_utf8 = dfa->is_utf8; @@ -201,7 +201,7 @@ build_wcs_buffer (re_string_t *pstr) unsigned char buf[64]; #endif mbstate_t prev_st; - int byte_idx, end_idx, remain_len; + Idx byte_idx, end_idx, remain_len; size_t mbclen; /* Build the buffers from pstr->valid_len to either pstr->len or @@ -258,12 +258,12 @@ build_wcs_buffer (re_string_t *pstr) /* Build wide character buffer PSTR->WCS like build_wcs_buffer, but for REG_ICASE. */ -static int +static reg_errcode_t internal_function build_wcs_upper_buffer (re_string_t *pstr) { mbstate_t prev_st; - int src_idx, byte_idx, end_idx, remain_len; + Idx src_idx, byte_idx, end_idx, remain_len; size_t mbclen; #ifdef _LIBC char buf[MB_LEN_MAX]; @@ -301,7 +301,7 @@ build_wcs_upper_buffer (re_string_t *pst mbclen = mbrtowc (&wc, ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx), remain_len, &pstr->cur_state); - if (BE (mbclen + 2 > 2, 1)) + if (BE ((size_t) (mbclen + 2) > 2, 1)) { wchar_t wcu = wc; if (iswlower (wc)) @@ -369,7 +369,7 @@ build_wcs_upper_buffer (re_string_t *pst else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); - if (BE (mbclen + 2 > 2, 1)) + if (BE ((size_t) (mbclen + 2) > 2, 1)) { wchar_t wcu = wc; if (iswlower (wc)) @@ -392,7 +392,7 @@ build_wcs_upper_buffer (re_string_t *pst if (pstr->offsets == NULL) { - pstr->offsets = re_malloc (int, pstr->bufs_len); + pstr->offsets = re_xmalloc (Idx, pstr->bufs_len); if (pstr->offsets == NULL) return REG_ESPACE; @@ -474,12 +474,12 @@ build_wcs_upper_buffer (re_string_t *pst /* Skip characters until the index becomes greater than NEW_RAW_IDX. Return the index. */ -static int +static Idx internal_function -re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc) +re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) { mbstate_t prev_st; - int rawbuf_idx; + Idx rawbuf_idx; size_t mbclen; wchar_t wc = 0; @@ -487,7 +487,7 @@ re_string_skip_chars (re_string_t *pstr, for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len; rawbuf_idx < new_raw_idx;) { - int remain_len; + Idx remain_len; remain_len = pstr->len - rawbuf_idx; prev_st = pstr->cur_state; mbclen = mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx, @@ -513,7 +513,7 @@ static void internal_function build_upper_buffer (re_string_t *pstr) { - int char_idx, end_idx; + Idx char_idx, end_idx; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (char_idx = pstr->valid_len; char_idx < end_idx; ++char_idx) @@ -536,7 +536,7 @@ static void internal_function re_string_translate_buffer (re_string_t *pstr) { - int buf_idx, end_idx; + Idx buf_idx, end_idx; end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (buf_idx = pstr->valid_len; buf_idx < end_idx; ++buf_idx) @@ -555,10 +555,13 @@ re_string_translate_buffer (re_string_t static reg_errcode_t internal_function -re_string_reconstruct (re_string_t *pstr, int idx, int eflags) +re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) { - int offset = idx - pstr->raw_mbs_idx; - if (BE (offset < 0, 0)) + Idx offset; + + if (BE (pstr->raw_mbs_idx <= idx, 0)) + offset = idx - pstr->raw_mbs_idx; + else { /* Reset buffer. */ #ifdef RE_ENABLE_I18N @@ -621,7 +624,7 @@ re_string_reconstruct (re_string_t *pstr #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { - int wcs_idx; + Idx wcs_idx; wint_t wc = WEOF; if (pstr->is_utf8) @@ -637,8 +640,9 @@ re_string_reconstruct (re_string_t *pstr { mbstate_t cur_state; wchar_t wc2; - int mlen = raw + pstr->len - p; + Idx mlen = raw + pstr->len - p; unsigned char buf[6]; + size_t mbclen; q = p; if (BE (pstr->trans != NULL, 0)) @@ -651,14 +655,13 @@ re_string_reconstruct (re_string_t *pstr /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); - mlen = (mbrtowc (&wc2, (const char *) p, mlen, - &cur_state) - - (raw + offset - p)); - if (mlen >= 0) + mbclen = mbrtowc (&wc2, (const char *) p, mlen, + &cur_state); + if (raw + offset - p <= mbclen && mbclen < (size_t) -2) { memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); - pstr->valid_len = mlen; + pstr->valid_len = mbclen - (raw + offset - p); wc = wc2; } break; @@ -672,7 +675,7 @@ re_string_reconstruct (re_string_t *pstr for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) pstr->wcs[wcs_idx] = WEOF; if (pstr->mbs_allocated) - memset (pstr->mbs, 255, pstr->valid_len); + memset (pstr->mbs, -1, pstr->valid_len); } pstr->valid_raw_len = pstr->valid_len; pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0) @@ -707,7 +710,7 @@ re_string_reconstruct (re_string_t *pstr { if (pstr->icase) { - int ret = build_wcs_upper_buffer (pstr); + reg_errcode_t ret = build_wcs_upper_buffer (pstr); if (BE (ret != REG_NOERROR, 0)) return ret; } @@ -731,10 +734,11 @@ re_string_reconstruct (re_string_t *pstr } static unsigned char -internal_function -re_string_peek_byte_case (const re_string_t *pstr, int idx) +internal_function __attribute ((pure)) +re_string_peek_byte_case (const re_string_t *pstr, Idx idx) { - int ch, off; + int ch; + Idx off; /* Handle the common (easiest) cases first. */ if (BE (!pstr->mbs_allocated, 1)) @@ -767,7 +771,7 @@ re_string_peek_byte_case (const re_strin } static unsigned char -internal_function +internal_function __attribute ((pure)) re_string_fetch_byte_case (re_string_t *pstr) { if (BE (!pstr->mbs_allocated, 1)) @@ -776,7 +780,8 @@ re_string_fetch_byte_case (re_string_t * #ifdef RE_ENABLE_I18N if (pstr->offsets_needed) { - int off, ch; + Idx off; + int ch; /* For tr_TR.UTF-8 [[:islower:]] there is [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip @@ -819,10 +824,10 @@ re_string_destruct (re_string_t *pstr) static unsigned int internal_function -re_string_context_at (const re_string_t *input, int idx, int eflags) +re_string_context_at (const re_string_t *input, Idx idx, int eflags) { int c; - if (BE (idx < 0, 0)) + if (BE (! REG_VALID_INDEX (idx), 0)) /* In this case, we use the value stored in input->tip_context, since we can't know the character in input->mbs[-1] here. */ return input->tip_context; @@ -833,15 +838,15 @@ re_string_context_at (const re_string_t if (input->mb_cur_max > 1) { wint_t wc; - int wc_idx = idx; + Idx wc_idx = idx; while(input->wcs[wc_idx] == WEOF) { #ifdef DEBUG /* It must not happen. */ - assert (wc_idx >= 0); + assert (REG_VALID_INDEX (wc_idx)); #endif --wc_idx; - if (wc_idx < 0) + if (! REG_VALID_INDEX (wc_idx)) return input->tip_context; } wc = input->wcs[wc_idx]; @@ -864,11 +869,11 @@ re_string_context_at (const re_string_t static reg_errcode_t internal_function -re_node_set_alloc (re_node_set *set, int size) +re_node_set_alloc (re_node_set *set, Idx size) { set->alloc = size; set->nelem = 0; - set->elems = re_malloc (int, size); + set->elems = re_xmalloc (Idx, size); if (BE (set->elems == NULL, 0)) return REG_ESPACE; return REG_NOERROR; @@ -876,11 +881,11 @@ re_node_set_alloc (re_node_set *set, int static reg_errcode_t internal_function -re_node_set_init_1 (re_node_set *set, int elem) +re_node_set_init_1 (re_node_set *set, Idx elem) { set->alloc = 1; set->nelem = 1; - set->elems = re_malloc (int, 1); + set->elems = re_malloc (Idx, 1); if (BE (set->elems == NULL, 0)) { set->alloc = set->nelem = 0; @@ -892,10 +897,10 @@ re_node_set_init_1 (re_node_set *set, in static reg_errcode_t internal_function -re_node_set_init_2 (re_node_set *set, int elem1, int elem2) +re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2) { set->alloc = 2; - set->elems = re_malloc (int, 2); + set->elems = re_malloc (Idx, 2); if (BE (set->elems == NULL, 0)) return REG_ESPACE; if (elem1 == elem2) @@ -928,13 +933,13 @@ re_node_set_init_copy (re_node_set *dest if (src->nelem > 0) { dest->alloc = dest->nelem; - dest->elems = re_malloc (int, dest->alloc); + dest->elems = re_malloc (Idx, dest->alloc); if (BE (dest->elems == NULL, 0)) { dest->alloc = dest->nelem = 0; return REG_ESPACE; } - memcpy (dest->elems, src->elems, src->nelem * sizeof (int)); + memcpy (dest->elems, src->elems, src->nelem * sizeof dest->elems[0]); } else re_node_set_init_empty (dest); @@ -950,7 +955,7 @@ internal_function re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { - int i1, i2, is, id, delta, sbase; + Idx i1, i2, is, id, delta, sbase; if (src1->nelem == 0 || src2->nelem == 0) return REG_NOERROR; @@ -958,8 +963,13 @@ re_node_set_add_intersect (re_node_set * conservative estimate. */ if (src1->nelem + src2->nelem + dest->nelem > dest->alloc) { - int new_alloc = src1->nelem + src2->nelem + dest->alloc; - int *new_elems = re_realloc (dest->elems, int, new_alloc); + Idx new_alloc = src1->nelem + src2->nelem + dest->alloc; + Idx *new_elems; + if (sizeof (Idx) < 3 + && (new_alloc < dest->alloc + || ((Idx) (src1->nelem + src2->nelem) < src1->nelem))) + return REG_ESPACE; + new_elems = re_xrealloc (dest->elems, Idx, new_alloc); if (BE (new_elems == NULL, 0)) return REG_ESPACE; dest->elems = new_elems; @@ -977,25 +987,25 @@ re_node_set_add_intersect (re_node_set * if (src1->elems[i1] == src2->elems[i2]) { /* Try to find the item in DEST. Maybe we could binary search? */ - while (id >= 0 && dest->elems[id] > src1->elems[i1]) + while (REG_VALID_INDEX (id) && dest->elems[id] > src1->elems[i1]) --id; - if (id < 0 || dest->elems[id] != src1->elems[i1]) + if (! REG_VALID_INDEX (id) || dest->elems[id] != src1->elems[i1]) dest->elems[--sbase] = src1->elems[i1]; - if (--i1 < 0 || --i2 < 0) + if (! REG_VALID_INDEX (--i1) || ! REG_VALID_INDEX (--i2)) break; } /* Lower the highest of the two items. */ else if (src1->elems[i1] < src2->elems[i2]) { - if (--i2 < 0) + if (! REG_VALID_INDEX (--i2)) break; } else { - if (--i1 < 0) + if (! REG_VALID_INDEX (--i1)) break; } } @@ -1008,7 +1018,7 @@ re_node_set_add_intersect (re_node_set * DEST elements are already in place; this is more or less the same loop that is in re_node_set_merge. */ dest->nelem += delta; - if (delta > 0 && id >= 0) + if (delta > 0 && REG_VALID_INDEX (id)) for (;;) { if (dest->elems[is] > dest->elems[id]) @@ -1022,13 +1032,13 @@ re_node_set_add_intersect (re_node_set * { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (--id < 0) + if (! REG_VALID_INDEX (--id)) break; } } /* Copy remaining SRC elements. */ - memcpy (dest->elems, dest->elems + sbase, delta * sizeof (int)); + memcpy (dest->elems, dest->elems + sbase, delta * sizeof dest->elems[0]); return REG_NOERROR; } @@ -1041,11 +1051,13 @@ internal_function re_node_set_init_union (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { - int i1, i2, id; + Idx i1, i2, id; if (src1 != NULL && src1->nelem > 0 && src2 != NULL && src2->nelem > 0) { dest->alloc = src1->nelem + src2->nelem; - dest->elems = re_malloc (int, dest->alloc); + if (sizeof (Idx) < 2 && dest->alloc < src1->nelem) + return REG_ESPACE; + dest->elems = re_xmalloc (Idx, dest->alloc); if (BE (dest->elems == NULL, 0)) return REG_ESPACE; } @@ -1073,13 +1085,13 @@ re_node_set_init_union (re_node_set *des if (i1 < src1->nelem) { memcpy (dest->elems + id, src1->elems + i1, - (src1->nelem - i1) * sizeof (int)); + (src1->nelem - i1) * sizeof dest->elems[0]); id += src1->nelem - i1; } else if (i2 < src2->nelem) { memcpy (dest->elems + id, src2->elems + i2, - (src2->nelem - i2) * sizeof (int)); + (src2->nelem - i2) * sizeof dest->elems[0]); id += src2->nelem - i2; } dest->nelem = id; @@ -1093,13 +1105,20 @@ static reg_errcode_t internal_function re_node_set_merge (re_node_set *dest, const re_node_set *src) { - int is, id, sbase, delta; + Idx is, id, sbase, delta; if (src == NULL || src->nelem == 0) return REG_NOERROR; + if (sizeof (Idx) < 3 + && ((Idx) (2 * src->nelem) < src->nelem + || (Idx) (2 * src->nelem + dest->nelem) < dest->nelem)) + return REG_ESPACE; if (dest->alloc < 2 * src->nelem + dest->nelem) { - int new_alloc = 2 * (src->nelem + dest->alloc); - int *new_buffer = re_realloc (dest->elems, int, new_alloc); + Idx new_alloc = src->nelem + dest->alloc; + Idx *new_buffer; + if (sizeof (Idx) < 4 && new_alloc < dest->alloc) + return REG_ESPACE; + new_buffer = re_x2realloc (dest->elems, Idx, &new_alloc); if (BE (new_buffer == NULL, 0)) return REG_ESPACE; dest->elems = new_buffer; @@ -1109,14 +1128,15 @@ re_node_set_merge (re_node_set *dest, co if (BE (dest->nelem == 0, 0)) { dest->nelem = src->nelem; - memcpy (dest->elems, src->elems, src->nelem * sizeof (int)); + memcpy (dest->elems, src->elems, src->nelem * sizeof dest->elems[0]); return REG_NOERROR; } /* Copy into the top of DEST the items of SRC that are not found in DEST. Maybe we could binary search in DEST? */ for (sbase = dest->nelem + 2 * src->nelem, - is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; ) + is = src->nelem - 1, id = dest->nelem - 1; + REG_VALID_INDEX (is) && REG_VALID_INDEX (id); ) { if (dest->elems[id] == src->elems[is]) is--, id--; @@ -1126,11 +1146,12 @@ re_node_set_merge (re_node_set *dest, co --id; } - if (is >= 0) + if (REG_VALID_INDEX (is)) { /* If DEST is exhausted, the remaining items of SRC must be unique. */ sbase -= is + 1; - memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (int)); + memcpy (dest->elems + sbase, src->elems, + (is + 1) * sizeof dest->elems[0]); } id = dest->nelem - 1; @@ -1155,11 +1176,11 @@ re_node_set_merge (re_node_set *dest, co { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (--id < 0) + if (! REG_VALID_INDEX (--id)) { /* Copy remaining SRC elements. */ memcpy (dest->elems, dest->elems + sbase, - delta * sizeof (int)); + delta * sizeof dest->elems[0]); break; } } @@ -1170,38 +1191,31 @@ re_node_set_merge (re_node_set *dest, co /* Insert the new element ELEM to the re_node_set* SET. SET should not already have ELEM. - return -1 if an error is occured, return 1 otherwise. */ + Return true if successful. */ -static int +static bool internal_function -re_node_set_insert (re_node_set *set, int elem) +re_node_set_insert (re_node_set *set, Idx elem) { - int idx; + Idx idx; /* In case the set is empty. */ if (set->alloc == 0) - { - if (BE (re_node_set_init_1 (set, elem) == REG_NOERROR, 1)) - return 1; - else - return -1; - } + return re_node_set_init_1 (set, elem) == REG_NOERROR; if (BE (set->nelem, 0) == 0) { /* We already guaranteed above that set->alloc != 0. */ set->elems[0] = elem; ++set->nelem; - return 1; + return true; } /* Realloc if we need. */ if (set->alloc == set->nelem) { - int *new_elems; - set->alloc = set->alloc * 2; - new_elems = re_realloc (set->elems, int, set->alloc); + Idx *new_elems = re_x2realloc (set->elems, Idx, &set->alloc); if (BE (new_elems == NULL, 0)) - return -1; + return false; set->elems = new_elems; } @@ -1222,57 +1236,56 @@ re_node_set_insert (re_node_set *set, in /* Insert the new element. */ set->elems[idx] = elem; ++set->nelem; - return 1; + return true; } /* Insert the new element ELEM to the re_node_set* SET. SET should not already have any element greater than or equal to ELEM. - Return -1 if an error is occured, return 1 otherwise. */ + Return true if successful. */ -static int +static bool internal_function -re_node_set_insert_last (re_node_set *set, int elem) +re_node_set_insert_last (re_node_set *set, Idx elem) { /* Realloc if we need. */ if (set->alloc == set->nelem) { - int *new_elems; - set->alloc = (set->alloc + 1) * 2; - new_elems = re_realloc (set->elems, int, set->alloc); + Idx *new_elems; + new_elems = re_x2realloc (set->elems, Idx, &set->alloc); if (BE (new_elems == NULL, 0)) - return -1; + return false; set->elems = new_elems; } /* Insert the new element. */ set->elems[set->nelem++] = elem; - return 1; + return true; } /* Compare two node sets SET1 and SET2. - return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */ + Return true if SET1 and SET2 are equivalent. */ -static int -internal_function +static bool +internal_function __attribute ((pure)) re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { - int i; + Idx i; if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem) - return 0; - for (i = set1->nelem ; --i >= 0 ; ) + return false; + for (i = set1->nelem ; REG_VALID_INDEX (--i) ; ) if (set1->elems[i] != set2->elems[i]) - return 0; - return 1; + return false; + return true; } /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ -static int -internal_function -re_node_set_contains (const re_node_set *set, int elem) +static Idx +internal_function __attribute ((pure)) +re_node_set_contains (const re_node_set *set, Idx elem) { - unsigned int idx, right, mid; - if (set->nelem <= 0) + __re_size_t idx, right, mid; + if (! REG_VALID_NONZERO_INDEX (set->nelem)) return 0; /* Binary search the element. */ @@ -1291,7 +1304,7 @@ re_node_set_contains (const re_node_set static void internal_function -re_node_set_remove_at (re_node_set *set, int idx) +re_node_set_remove_at (re_node_set *set, Idx idx) { if (idx < 0 || idx >= set->nelem) return; @@ -1302,31 +1315,31 @@ re_node_set_remove_at (re_node_set *set, /* Add the token TOKEN to dfa->nodes, and return the index of the token. - Or return -1, if an error will be occured. */ + Or return REG_MISSING if an error occurred. */ -static int +static Idx internal_function re_dfa_add_node (re_dfa_t *dfa, re_token_t token) { int type = token.type; if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) { - int new_nodes_alloc = dfa->nodes_alloc * 2; - int *new_nexts, *new_indices; + Idx new_nodes_alloc = dfa->nodes_alloc; + Idx *new_nexts, *new_indices; re_node_set *new_edests, *new_eclosures; - re_token_t *new_nodes = re_realloc (dfa->nodes, re_token_t, - new_nodes_alloc); + re_token_t *new_nodes = re_x2realloc (dfa->nodes, re_token_t, + &new_nodes_alloc); if (BE (new_nodes == NULL, 0)) - return -1; + return REG_MISSING; dfa->nodes = new_nodes; - new_nexts = re_realloc (dfa->nexts, int, new_nodes_alloc); - new_indices = re_realloc (dfa->org_indices, int, new_nodes_alloc); - new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc); + new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc); + new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc); + new_edests = re_xrealloc (dfa->edests, re_node_set, new_nodes_alloc); new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc); if (BE (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL, 0)) - return -1; + return REG_MISSING; dfa->nexts = new_nexts; dfa->org_indices = new_indices; dfa->edests = new_edests; @@ -1339,18 +1352,18 @@ re_dfa_add_node (re_dfa_t *dfa, re_token dfa->nodes[dfa->nodes_len].accept_mb = (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET; #endif - dfa->nexts[dfa->nodes_len] = -1; + dfa->nexts[dfa->nodes_len] = REG_MISSING; re_node_set_init_empty (dfa->edests + dfa->nodes_len); re_node_set_init_empty (dfa->eclosures + dfa->nodes_len); return dfa->nodes_len++; } -static inline unsigned int +static inline re_hashval_t internal_function calc_state_hash (const re_node_set *nodes, unsigned int context) { - unsigned int hash = nodes->nelem + context; - int i; + re_hashval_t hash = nodes->nelem + context; + Idx i; for (i = 0 ; i < nodes->nelem ; i++) hash += nodes->elems[i]; return hash; @@ -1369,10 +1382,10 @@ static re_dfastate_t* internal_function re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa, const re_node_set *nodes) { - unsigned int hash; + re_hashval_t hash; re_dfastate_t *new_state; struct re_state_table_entry *spot; - int i; + Idx i; #ifdef lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; @@ -1420,10 +1433,10 @@ internal_function re_acquire_state_context (reg_errcode_t *err, re_dfa_t *dfa, const re_node_set *nodes, unsigned int context) { - unsigned int hash; + re_hashval_t hash; re_dfastate_t *new_state; struct re_state_table_entry *spot; - int i; + Idx i; #ifdef lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; @@ -1461,11 +1474,11 @@ re_acquire_state_context (reg_errcode_t static reg_errcode_t internal_function -register_state (re_dfa_t *dfa, re_dfastate_t *newstate, unsigned int hash) +register_state (const re_dfa_t *dfa, re_dfastate_t *newstate, re_hashval_t hash) { struct re_state_table_entry *spot; reg_errcode_t err; - int i; + Idx i; newstate->hash = hash; err = re_node_set_alloc (&newstate->non_eps_nodes, newstate->nodes.nelem); @@ -1473,17 +1486,21 @@ register_state (re_dfa_t *dfa, re_dfasta return REG_ESPACE; for (i = 0; i < newstate->nodes.nelem; i++) { - int elem = newstate->nodes.elems[i]; + Idx elem = newstate->nodes.elems[i]; if (!IS_EPSILON_NODE (dfa->nodes[elem].type)) - re_node_set_insert_last (&newstate->non_eps_nodes, elem); + { + bool ok = re_node_set_insert_last (&newstate->non_eps_nodes, elem); + if (BE (! ok, 0)) + return REG_ESPACE; + } } spot = dfa->state_table + (hash & dfa->state_hash_mask); if (BE (spot->alloc <= spot->num, 0)) { - int new_alloc = 2 * spot->num + 2; - re_dfastate_t **new_array = re_realloc (spot->array, re_dfastate_t *, - new_alloc); + Idx new_alloc = spot->num; + re_dfastate_t **new_array = re_x2realloc (spot->array, re_dfastate_t *, + &new_alloc); if (BE (new_array == NULL, 0)) return REG_ESPACE; spot->array = new_array; @@ -1498,13 +1515,14 @@ register_state (re_dfa_t *dfa, re_dfasta static re_dfastate_t * internal_function -create_ci_newstate (re_dfa_t *dfa, const re_node_set *nodes, unsigned int hash) +create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, + re_hashval_t hash) { - int i; + Idx i; reg_errcode_t err; re_dfastate_t *newstate; - newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); + newstate = re_calloc (re_dfastate_t, 1); if (BE (newstate == NULL, 0)) return NULL; err = re_node_set_init_copy (&newstate->nodes, nodes); @@ -1547,14 +1565,14 @@ create_ci_newstate (re_dfa_t *dfa, const static re_dfastate_t * internal_function -create_cd_newstate (re_dfa_t *dfa, const re_node_set *nodes, - unsigned int context, unsigned int hash) +create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, + unsigned int context, re_hashval_t hash) { - int i, nctx_nodes = 0; + Idx i, nctx_nodes = 0; reg_errcode_t err; re_dfastate_t *newstate; - newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); + newstate = re_calloc (re_dfastate_t, 1); if (BE (newstate == NULL, 0)) return NULL; err = re_node_set_init_copy (&newstate->nodes, nodes); Index: lib/regex_internal.h =================================================================== RCS file: /fetish/cu/lib/regex_internal.h,v retrieving revision 1.2 diff -p -u -r1.2 regex_internal.h --- lib/regex_internal.h 23 Aug 2005 19:41:09 -0000 1.2 +++ lib/regex_internal.h 9 Sep 2005 20:58:16 -0000 @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -90,8 +91,6 @@ # define inline #endif -/* Number of bits in a byte. */ -#define BYTE_BITS 8 /* Number of single byte character. */ #define SBC_MAX 256 @@ -123,26 +122,73 @@ extern const char __re_error_msgid[] attribute_hidden; extern const size_t __re_error_msgid_idx[] attribute_hidden; -/* Number of bits in an unsinged int. */ -#define UINT_BITS (sizeof (unsigned int) * BYTE_BITS) -/* Number of unsigned int in an bit_set. */ -#define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS) -typedef unsigned int bitset[BITSET_UINTS]; -typedef unsigned int *re_bitset_ptr_t; -typedef const unsigned int *re_const_bitset_ptr_t; - -#define bitset_set(set,i) (set[i / UINT_BITS] |= 1 << i % UINT_BITS) -#define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1 << i % UINT_BITS)) -#define bitset_contain(set,i) (set[i / UINT_BITS] & (1 << i % UINT_BITS)) -#define bitset_empty(set) memset (set, 0, sizeof (unsigned int) * BITSET_UINTS) -#define bitset_set_all(set) \ - memset (set, 255, sizeof (unsigned int) * BITSET_UINTS) -#define bitset_copy(dest,src) \ - memcpy (dest, src, sizeof (unsigned int) * BITSET_UINTS) -static inline void bitset_not (bitset set); -static inline void bitset_merge (bitset dest, const bitset src); -static inline void bitset_not_merge (bitset dest, const bitset src); -static inline void bitset_mask (bitset dest, const bitset src); +typedef __re_idx_t Idx; + +/* Special return value for failure to match. */ +#define REG_MISSING ((Idx) -1) + +/* Special return value for internal error. */ +#define REG_ERROR ((Idx) -2) + +/* Test whether N is a valid index, and is not one of the above. */ +#ifdef _REGEX_LARGE_OFFSETS +# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR) +#else +# define REG_VALID_INDEX(n) (0 <= (n)) +#endif + +/* Test whether N is a valid nonzero index. */ +#ifdef _REGEX_LARGE_OFFSETS +# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1)) +#else +# define REG_VALID_NONZERO_INDEX(n) (0 < (n)) +#endif + +/* A hash value, suitable for computing hash tables. */ +typedef __re_size_t re_hashval_t; + +/* An integer used to represent a set of bits. It must be unsigned, + and must be at least as wide as unsigned int. */ +typedef unsigned long int bitset_word; + +/* Maximum value of a bitset word. It must be useful in preprocessor + contexts, and must be consistent with bitset_word. */ +#define BITSET_WORD_MAX ULONG_MAX + +/* Number of bits in a bitset word. Avoid greater-than-32-bit + integers and unconditional shifts by more than 31 bits, as they're + not portable. */ +#if BITSET_WORD_MAX == 0xffffffff +# define BITSET_WORD_BITS 32 +#elif BITSET_WORD_MAX >> 31 >> 5 == 1 +# define BITSET_WORD_BITS 36 +#elif BITSET_WORD_MAX >> 31 >> 16 == 1 +# define BITSET_WORD_BITS 48 +#elif BITSET_WORD_MAX >> 31 >> 28 == 1 +# define BITSET_WORD_BITS 60 +#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1 +# define BITSET_WORD_BITS 64 +#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1 +# define BITSET_WORD_BITS 72 +#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1 +# define BITSET_WORD_BITS 128 +#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1 +# define BITSET_WORD_BITS 256 +#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1 +# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */ +# if BITSET_WORD_BITS <= SBC_MAX +# error "Invalid SBC_MAX" +# endif +#else +# error "Add case for new bitset_word size" +#endif + +/* Number of bitset words in a bitset. */ +#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) + +typedef bitset_word bitset[BITSET_WORDS]; +typedef bitset_word *re_bitset_ptr_t; +typedef const bitset_word *re_const_bitset_ptr_t; #define PREV_WORD_CONSTRAINT 0x0001 #define PREV_NOTWORD_CONSTRAINT 0x0002 @@ -171,9 +217,9 @@ typedef enum typedef struct { - int alloc; - int nelem; - int *elems; + Idx alloc; + Idx nelem; + Idx *elems; } re_node_set; typedef enum @@ -259,19 +305,19 @@ typedef struct unsigned int non_match : 1; /* # of multibyte characters. */ - int nmbchars; + Idx nmbchars; /* # of collating symbols. */ - int ncoll_syms; + Idx ncoll_syms; /* # of equivalence classes. */ - int nequiv_classes; + Idx nequiv_classes; /* # of range expressions. */ - int nranges; + Idx nranges; /* # of character classes. */ - int nchar_classes; + Idx nchar_classes; } re_charset_t; #endif /* RE_ENABLE_I18N */ @@ -284,7 +330,7 @@ typedef struct #ifdef RE_ENABLE_I18N re_charset_t *mbcset; /* for COMPLEX_BRACKET */ #endif /* RE_ENABLE_I18N */ - int idx; /* for BACK_REF */ + Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; #if __GNUC__ >= 2 @@ -318,40 +364,40 @@ struct re_string_t #ifdef RE_ENABLE_I18N /* Store the wide character string which is corresponding to MBS. */ wint_t *wcs; - int *offsets; + Idx *offsets; mbstate_t cur_state; #endif /* Index in RAW_MBS. Each character mbs[i] corresponds to raw_mbs[raw_mbs_idx + i]. */ - int raw_mbs_idx; + Idx raw_mbs_idx; /* The length of the valid characters in the buffers. */ - int valid_len; + Idx valid_len; /* The corresponding number of bytes in raw_mbs array. */ - int valid_raw_len; + Idx valid_raw_len; /* The length of the buffers MBS and WCS. */ - int bufs_len; + Idx bufs_len; /* The index in MBS, which is updated by re_string_fetch_byte. */ - int cur_idx; + Idx cur_idx; /* length of RAW_MBS array. */ - int raw_len; + Idx raw_len; /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */ - int len; + Idx len; /* End of the buffer may be shorter than its length in the cases such as re_match_2, re_search_2. Then, we use STOP for end of the buffer instead of LEN. */ - int raw_stop; + Idx raw_stop; /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */ - int stop; + Idx stop; /* The context of mbs[0]. We store the context independently, since the context of mbs[0] may be different from raw_mbs[0], which is the beginning of the input string. */ unsigned int tip_context; /* The translation passed as a part of an argument of re_compile_pattern. */ - unsigned RE_TRANSLATE_TYPE trans; + unsigned REG_TRANSLATE_TYPE trans; /* Copy of re_dfa_t's word_char. */ re_const_bitset_ptr_t word_char; - /* 1 if REG_ICASE. */ + /* true if REG_ICASE. */ unsigned char icase; unsigned char is_utf8; unsigned char map_notascii; @@ -375,42 +421,18 @@ typedef struct re_dfa_t re_dfa_t; # endif #endif -static reg_errcode_t re_string_allocate (re_string_t *pstr, const char *str, - int len, int init_len, - RE_TRANSLATE_TYPE trans, int icase, - const re_dfa_t *dfa) - internal_function; -static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str, - int len, RE_TRANSLATE_TYPE trans, - int icase, const re_dfa_t *dfa) - internal_function; -static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx, - int eflags) internal_function; static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, - int new_buf_len) + Idx new_buf_len) internal_function; #ifdef RE_ENABLE_I18N static void build_wcs_buffer (re_string_t *pstr) internal_function; -static int build_wcs_upper_buffer (re_string_t *pstr) internal_function; +static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) + internal_function; #endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr) internal_function; static void re_string_translate_buffer (re_string_t *pstr) internal_function; -static void re_string_destruct (re_string_t *pstr) internal_function; -#ifdef RE_ENABLE_I18N -static int re_string_elem_size_at (const re_string_t *pstr, int idx) - internal_function __attribute ((pure)); -static inline int re_string_char_size_at (const re_string_t *pstr, int idx) - internal_function __attribute ((pure)); -static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx) - internal_function __attribute ((pure)); -#endif /* RE_ENABLE_I18N */ -static unsigned int re_string_context_at (const re_string_t *input, int idx, - int eflags) - internal_function __attribute ((pure)); -static unsigned char re_string_peek_byte_case (const re_string_t *pstr, - int idx) - internal_function __attribute ((pure)); -static unsigned char re_string_fetch_byte_case (re_string_t *pstr) +static unsigned int re_string_context_at (const re_string_t *input, + Idx idx, int eflags) internal_function __attribute ((pure)); #define re_string_peek_byte(pstr, offset) \ @@ -430,10 +452,86 @@ static unsigned char re_string_fetch_byt #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) +#include + +#ifndef _LIBC +# if HAVE_ALLOCA +/* The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. */ +# define __libc_use_alloca(n) ((n) < 4032) +# else +/* alloca is implemented with malloc, so just use malloc. */ +# define __libc_use_alloca(n) 0 +# endif +#endif + #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t))) +#define re_xmalloc(t,n) ((t *) re_xnmalloc (n, sizeof (t))) +#define re_calloc(t,n) ((t *) calloc (n, sizeof (t))) #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) +#define re_xrealloc(p,t,n) ((t *) re_xnrealloc (p, n, sizeof (t))) +#define re_x2realloc(p,t,pn) ((t *) re_x2nrealloc (p, pn, sizeof (t))) #define re_free(p) free (p) +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +/* Return true if an array of N objects, each of size S, cannot exist + due to size arithmetic overflow. S must be nonzero. */ +static inline bool +re_alloc_oversized (size_t n, size_t s) +{ + return BE (SIZE_MAX / s < n, 0); +} + +/* Return true if an array of (2 * N + 1) objects, each of size S, + cannot exist due to size arithmetic overflow. S must be nonzero. */ +static inline bool +re_x2alloc_oversized (size_t n, size_t s) +{ + return BE ((SIZE_MAX / s - 1) / 2 < n, 0); +} + +/* Allocate an array of N objects, each with S bytes of memory, + dynamically, with error checking. S must be nonzero. */ +static inline void * +re_xnmalloc (size_t n, size_t s) +{ + return re_alloc_oversized (n, s) ? NULL : malloc (n * s); +} + +/* Change the size of an allocated block of memory P to an array of N + objects each of S bytes, with error checking. S must be nonzero. */ +static inline void * +re_xnrealloc (void *p, size_t n, size_t s) +{ + return re_alloc_oversized (n, s) ? NULL : realloc (p, n * s); +} + +/* Reallocate a block of memory P to an array of (2 * (*PN) + 1) + objects each of S bytes, with error checking. S must be nonzero. + If the allocation is successful, set *PN to the new allocation + count and return the resulting pointer. Otherwise, return + NULL. */ +static inline void * +re_x2nrealloc (void *p, size_t *pn, size_t s) +{ + if (re_x2alloc_oversized (*pn, s)) + return NULL; + else + { + /* Add 1 in case *PN is zero. */ + size_t n1 = 2 * *pn + 1; + p = realloc (p, n1 * s); + if (BE (p != NULL, 1)) + *pn = n1; + return p; + } +} + struct bin_tree_t { struct bin_tree_t *parent; @@ -446,7 +544,7 @@ struct bin_tree_t /* `node_idx' is the index in dfa->nodes, if `type' == 0. Otherwise `type' indicate the type of this node. */ - int node_idx; + Idx node_idx; }; typedef struct bin_tree_t bin_tree_t; @@ -490,7 +588,7 @@ typedef struct bin_tree_storage_t bin_tr struct re_dfastate_t { - unsigned int hash; + re_hashval_t hash; re_node_set nodes; re_node_set non_eps_nodes; re_node_set inveclosure; @@ -510,8 +608,8 @@ typedef struct re_dfastate_t re_dfastate struct re_state_table_entry { - int num; - int alloc; + Idx num; + Idx alloc; re_dfastate_t **array; }; @@ -519,8 +617,8 @@ struct re_state_table_entry typedef struct { - int next_idx; - int alloc; + Idx next_idx; + Idx alloc; re_dfastate_t **array; } state_array_t; @@ -528,8 +626,8 @@ typedef struct typedef struct { - int node; - int str_idx; /* The position NODE match at. */ + Idx node; + Idx str_idx; /* The position NODE match at. */ state_array_t path; } re_sub_match_last_t; @@ -539,21 +637,20 @@ typedef struct typedef struct { - int str_idx; - int node; - int next_last_offset; + Idx str_idx; + Idx node; state_array_t *path; - int alasts; /* Allocation size of LASTS. */ - int nlasts; /* The number of LASTS. */ + Idx alasts; /* Allocation size of LASTS. */ + Idx nlasts; /* The number of LASTS. */ re_sub_match_last_t **lasts; } re_sub_match_top_t; struct re_backref_cache_entry { - int node; - int str_idx; - int subexp_from; - int subexp_to; + Idx node; + Idx str_idx; + Idx subexp_from; + Idx subexp_to; char more; char unused; unsigned short int eps_reachable_subexps_map; @@ -571,18 +668,18 @@ typedef struct /* EFLAGS of the argument of regexec. */ int eflags; /* Where the matching ends. */ - int match_last; - int last_node; + Idx match_last; + Idx last_node; /* The state log used by the matcher. */ re_dfastate_t **state_log; - int state_log_top; + Idx state_log_top; /* Back reference cache. */ - int nbkref_ents; - int abkref_ents; + Idx nbkref_ents; + Idx abkref_ents; struct re_backref_cache_entry *bkref_ents; int max_mb_elem_len; - int nsub_tops; - int asub_tops; + Idx nsub_tops; + Idx asub_tops; re_sub_match_top_t **sub_tops; } re_match_context_t; @@ -590,33 +687,33 @@ typedef struct { re_dfastate_t **sifted_states; re_dfastate_t **limited_states; - int last_node; - int last_str_idx; + Idx last_node; + Idx last_str_idx; re_node_set limits; } re_sift_context_t; struct re_fail_stack_ent_t { - int idx; - int node; + Idx idx; + Idx node; regmatch_t *regs; re_node_set eps_via_nodes; }; struct re_fail_stack_t { - int num; - int alloc; + Idx num; + Idx alloc; struct re_fail_stack_ent_t *stack; }; struct re_dfa_t { re_token_t *nodes; - int nodes_alloc; - int nodes_len; - int *nexts; - int *org_indices; + Idx nodes_alloc; + Idx nodes_len; + Idx *nexts; + Idx *org_indices; re_node_set *edests; re_node_set *eclosures; re_node_set *inveclosures; @@ -631,14 +728,13 @@ struct re_dfa_t int str_tree_storage_idx; /* number of subexpressions `re_nsub' is in regex_t. */ - unsigned int state_hash_mask; - int states_alloc; - int init_node; - int nbackref; /* The number of backreference in this dfa. */ + re_hashval_t state_hash_mask; + Idx init_node; + Idx nbackref; /* The number of backreference in this dfa. */ /* Bitmap expressing which backreference is used. */ - unsigned int used_bkref_map; - unsigned int completed_bkref_map; + bitset_word used_bkref_map; + bitset_word completed_bkref_map; unsigned int has_plural_match : 1; /* If this dfa has "multibyte node", which is a backreference or @@ -651,51 +747,20 @@ struct re_dfa_t int mb_cur_max; bitset word_char; reg_syntax_t syntax; - int *subexp_map; + Idx *subexp_map; #ifdef DEBUG char* re_str; #endif __libc_lock_define (, lock) }; -#ifndef RE_NO_INTERNAL_PROTOTYPES -static reg_errcode_t re_node_set_alloc (re_node_set *set, int size) internal_function; -static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem) internal_function; -static reg_errcode_t re_node_set_init_2 (re_node_set *set, int elem1, - int elem2) internal_function; #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) -static reg_errcode_t re_node_set_init_copy (re_node_set *dest, - const re_node_set *src) internal_function; -static reg_errcode_t re_node_set_add_intersect (re_node_set *dest, - const re_node_set *src1, - const re_node_set *src2) internal_function; -static reg_errcode_t re_node_set_init_union (re_node_set *dest, - const re_node_set *src1, - const re_node_set *src2) internal_function; -static reg_errcode_t re_node_set_merge (re_node_set *dest, - const re_node_set *src) internal_function; -static int re_node_set_insert (re_node_set *set, int elem) internal_function; -static int re_node_set_insert_last (re_node_set *set, - int elem) internal_function; -static int re_node_set_compare (const re_node_set *set1, - const re_node_set *set2) - internal_function __attribute ((pure)); -static int re_node_set_contains (const re_node_set *set, int elem) - internal_function __attribute ((pure)); -static void re_node_set_remove_at (re_node_set *set, int idx) internal_function; #define re_node_set_remove(set,id) \ (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1)) #define re_node_set_empty(p) ((p)->nelem = 0) #define re_node_set_free(set) re_free ((set)->elems) -static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token) internal_function; -static re_dfastate_t *re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa, - const re_node_set *nodes) internal_function; -static re_dfastate_t *re_acquire_state_context (reg_errcode_t *err, - re_dfa_t *dfa, - const re_node_set *nodes, - unsigned int context) internal_function; + static void free_state (re_dfastate_t *state) internal_function; -#endif typedef enum @@ -720,43 +785,79 @@ typedef struct /* Inline functions for bitset operation. */ + static inline void -bitset_not (bitset set) +bitset_set (bitset set, Idx i) { - int bitset_i; - for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) - set[bitset_i] = ~set[bitset_i]; + set[i / BITSET_WORD_BITS] |= (bitset_word) 1 << i % BITSET_WORD_BITS; } static inline void -bitset_merge (bitset dest, const bitset src) +bitset_clear (bitset set, Idx i) +{ + set[i / BITSET_WORD_BITS] &= ~ ((bitset_word) 1 << i % BITSET_WORD_BITS); +} + +static inline bool +bitset_contain (const bitset set, Idx i) { - int bitset_i; - for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) - dest[bitset_i] |= src[bitset_i]; + return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1; } static inline void -bitset_not_merge (bitset dest, const bitset src) +bitset_empty (bitset set) +{ + memset (set, 0, sizeof (bitset)); +} + +static inline void +bitset_set_all (bitset set) +{ + memset (set, -1, sizeof (bitset_word) * (SBC_MAX / BITSET_WORD_BITS)); + if (SBC_MAX % BITSET_WORD_BITS != 0) + set[BITSET_WORDS - 1] = + ((bitset_word) 1 << SBC_MAX % BITSET_WORD_BITS) - 1; +} + +static inline void +bitset_copy (bitset dest, const bitset src) +{ + memcpy (dest, src, sizeof (bitset)); +} + +static inline void +bitset_not (bitset set) +{ + int i; + for (i = 0; i < SBC_MAX / BITSET_WORD_BITS; ++i) + set[i] = ~set[i]; + if (SBC_MAX % BITSET_WORD_BITS != 0) + set[BITSET_WORDS - 1] = + ((((bitset_word) 1 << SBC_MAX % BITSET_WORD_BITS) - 1) + & ~set[BITSET_WORDS - 1]); +} + +static inline void +bitset_merge (bitset dest, const bitset src) { int i; - for (i = 0; i < BITSET_UINTS; ++i) - dest[i] |= ~src[i]; + for (i = 0; i < BITSET_WORDS; ++i) + dest[i] |= src[i]; } static inline void bitset_mask (bitset dest, const bitset src) { - int bitset_i; - for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) - dest[bitset_i] &= src[bitset_i]; + int i; + for (i = 0; i < BITSET_WORDS; ++i) + dest[i] &= src[i]; } -#if defined RE_ENABLE_I18N && !defined RE_NO_INTERNAL_PROTOTYPES +#if defined RE_ENABLE_I18N /* Inline functions for re_string. */ static inline int -internal_function -re_string_char_size_at (const re_string_t *pstr, int idx) +internal_function __attribute ((pure)) +re_string_char_size_at (const re_string_t *pstr, Idx idx) { int byte_idx; if (pstr->mb_cur_max == 1) @@ -768,8 +869,8 @@ re_string_char_size_at (const re_string_ } static inline wint_t -internal_function -re_string_wchar_at (const re_string_t *pstr, int idx) +internal_function __attribute ((pure)) +re_string_wchar_at (const re_string_t *pstr, Idx idx) { if (pstr->mb_cur_max == 1) return (wint_t) pstr->mbs[idx]; @@ -777,8 +878,8 @@ re_string_wchar_at (const re_string_t *p } static int -internal_function -re_string_elem_size_at (const re_string_t *pstr, int idx) +internal_function __attribute ((pure)) +re_string_elem_size_at (const re_string_t *pstr, Idx idx) { #ifdef _LIBC const unsigned char *p, *extra; Index: lib/regexec.c =================================================================== RCS file: /fetish/cu/lib/regexec.c,v retrieving revision 1.3 diff -p -u -r1.3 regexec.c --- lib/regexec.c 23 Aug 2005 19:41:09 -0000 1.3 +++ lib/regexec.c 9 Sep 2005 20:58:17 -0000 @@ -18,98 +18,101 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, - int n) internal_function; + Idx n) internal_function; static void match_ctx_clean (re_match_context_t *mctx) internal_function; static void match_ctx_free (re_match_context_t *cache) internal_function; -static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, int node, - int str_idx, int from, int to) +static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node, + Idx str_idx, Idx from, Idx to) internal_function; -static int search_cur_bkref_entry (re_match_context_t *mctx, int str_idx) +static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) internal_function; -static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, int node, - int str_idx) internal_function; +static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node, + Idx str_idx) internal_function; static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, - int node, int str_idx) + Idx node, Idx str_idx) internal_function; static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, - re_dfastate_t **limited_sts, int last_node, - int last_str_idx) + re_dfastate_t **limited_sts, Idx last_node, + Idx last_str_idx) internal_function; static reg_errcode_t re_search_internal (const regex_t *preg, - const char *string, int length, - int start, int range, int stop, + const char *string, Idx length, + Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags) internal_function; -static int re_search_2_stub (struct re_pattern_buffer *bufp, - const char *string1, int length1, - const char *string2, int length2, - int start, int range, struct re_registers *regs, - int stop, int ret_len) internal_function; -static int re_search_stub (struct re_pattern_buffer *bufp, - const char *string, int length, int start, - int range, int stop, struct re_registers *regs, - int ret_len) internal_function; +static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp, + const char *string1, Idx length1, + const char *string2, Idx length2, + Idx start, regoff_t range, + struct re_registers *regs, + Idx stop, bool ret_len) internal_function; +static regoff_t re_search_stub (struct re_pattern_buffer *bufp, + const char *string, Idx length, Idx start, + regoff_t range, Idx stop, + struct re_registers *regs, + bool ret_len) internal_function; static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, - int nregs, int regs_allocated) internal_function; + Idx nregs, int regs_allocated) internal_function; static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx) internal_function; -static int check_matching (re_match_context_t *mctx, int fl_longest_match, - int *p_match_first) +static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, + Idx *p_match_first) internal_function; -static int check_halt_state_context (const re_match_context_t *mctx, - const re_dfastate_t *state, int idx) +static Idx check_halt_state_context (const re_match_context_t *mctx, + const re_dfastate_t *state, Idx idx) internal_function; static void update_regs (re_dfa_t *dfa, regmatch_t *pmatch, - regmatch_t *prev_idx_match, int cur_node, - int cur_idx, int nmatch) internal_function; + regmatch_t *prev_idx_match, Idx cur_node, + Idx cur_idx, Idx nmatch) internal_function; static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, - int str_idx, int dest_node, int nregs, + Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) internal_function; static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, - int fl_backtrack) internal_function; + bool fl_backtrack) internal_function; static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs) internal_function; #ifdef RE_ENABLE_I18N static int sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, - int node_idx, int str_idx, int max_str_idx) internal_function; + Idx node_idx, Idx str_idx, Idx max_str_idx) internal_function; #endif /* RE_ENABLE_I18N */ static reg_errcode_t sift_states_backward (re_match_context_t *mctx, re_sift_context_t *sctx) internal_function; static reg_errcode_t build_sifted_states (re_match_context_t *mctx, - re_sift_context_t *sctx, int str_idx, + re_sift_context_t *sctx, Idx str_idx, re_node_set *cur_dest) internal_function; static reg_errcode_t update_cur_sifted_state (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, + Idx str_idx, re_node_set *dest_nodes) internal_function; static reg_errcode_t add_epsilon_src_nodes (re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates) internal_function; -static int check_dst_limits (re_match_context_t *mctx, re_node_set *limits, - int dst_node, int dst_idx, int src_node, - int src_idx) internal_function; -static int check_dst_limits_calc_pos_1 (re_match_context_t *mctx, - int boundaries, int subexp_idx, - int from_node, int bkref_idx) internal_function; -static int check_dst_limits_calc_pos (re_match_context_t *mctx, - int limit, int subexp_idx, - int node, int str_idx, - int bkref_idx) internal_function; +static bool check_dst_limits (const re_match_context_t *mctx, + const re_node_set *limits, + Idx dst_node, Idx dst_idx, Idx src_node, + Idx src_idx) internal_function; +static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, + int boundaries, Idx subexp_idx, + Idx from_node, Idx bkref_idx) internal_function; +static int check_dst_limits_calc_pos (const re_match_context_t *mctx, + Idx limit, Idx subexp_idx, + Idx node, Idx str_idx, + Idx bkref_idx) internal_function; static reg_errcode_t check_subexp_limits (re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, - int str_idx) internal_function; + Idx str_idx) internal_function; static reg_errcode_t sift_states_bkref (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, const re_node_set *candidates) internal_function; + Idx str_idx, const re_node_set *candidates) internal_function; static reg_errcode_t merge_state_array (re_dfa_t *dfa, re_dfastate_t **dst, - re_dfastate_t **src, int num) internal_function; + re_dfastate_t **src, Idx num) internal_function; static re_dfastate_t *find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) internal_function; static re_dfastate_t *transit_state (reg_errcode_t *err, @@ -120,7 +123,7 @@ static re_dfastate_t *merge_state_with_l re_dfastate_t *next_state) internal_function; static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, - int str_idx) internal_function; + Idx str_idx) internal_function; #if 0 static re_dfastate_t *transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, @@ -133,47 +136,48 @@ static reg_errcode_t transit_state_mb (r static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) internal_function; static reg_errcode_t get_subexp (re_match_context_t *mctx, - int bkref_node, int bkref_str_idx) internal_function; + Idx bkref_node, Idx bkref_str_idx) internal_function; static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, - int bkref_node, int bkref_str) internal_function; -static int find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, - int subexp_idx, int type) internal_function; + Idx bkref_node, Idx bkref_str) internal_function; +static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, + Idx subexp_idx, int type) internal_function; static reg_errcode_t check_arrival (re_match_context_t *mctx, - state_array_t *path, int top_node, - int top_str, int last_node, int last_str, + state_array_t *path, Idx top_node, + Idx top_str, Idx last_node, Idx last_str, int type) internal_function; static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx, - int str_idx, + Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes) internal_function; static reg_errcode_t check_arrival_expand_ecl (re_dfa_t *dfa, re_node_set *cur_nodes, - int ex_subexp, int type) internal_function; + Idx ex_subexp, int type) internal_function; static reg_errcode_t check_arrival_expand_ecl_sub (re_dfa_t *dfa, re_node_set *dst_nodes, - int target, int ex_subexp, + Idx target, Idx ex_subexp, int type) internal_function; static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx, - re_node_set *cur_nodes, int cur_str, - int subexp_num, int type) internal_function; -static int build_trtable (re_dfa_t *dfa, - re_dfastate_t *state) internal_function; + re_node_set *cur_nodes, Idx cur_str, + Idx subexp_num, int type) internal_function; +static bool build_trtable (re_dfa_t *dfa, + re_dfastate_t *state) internal_function; #ifdef RE_ENABLE_I18N -static int check_node_accept_bytes (re_dfa_t *dfa, int node_idx, - const re_string_t *input, int idx) internal_function; +static int check_node_accept_bytes (re_dfa_t *dfa, Idx node_idx, + const re_string_t *input, Idx idx) internal_function; # ifdef _LIBC static unsigned int find_collation_sequence_value (const unsigned char *mbs, size_t name_len) internal_function; # endif /* _LIBC */ #endif /* RE_ENABLE_I18N */ -static int group_nodes_into_DFAstates (re_dfa_t *dfa, +static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *states_node, bitset *states_ch) internal_function; -static int check_node_accept (const re_match_context_t *mctx, - const re_token_t *node, int idx) internal_function; +static bool check_node_accept (const re_match_context_t *mctx, + const re_token_t *node, Idx idx) + internal_function; static reg_errcode_t extend_buffers (re_match_context_t *mctx) internal_function; /* Entry point for POSIX code. */ @@ -197,9 +201,9 @@ regexec (const regex_t *__restrict preg, size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; - int start, length; + Idx start, length; #ifdef _LIBC - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; #endif if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) @@ -217,11 +221,11 @@ regexec (const regex_t *__restrict preg, } __libc_lock_lock (dfa->lock); - if (preg->no_sub) - err = re_search_internal (preg, string, length, start, length - start, + if (preg->re_no_sub) + err = re_search_internal (preg, string, length, start, length, length, 0, NULL, eflags); else - err = re_search_internal (preg, string, length, start, length - start, + err = re_search_internal (preg, string, length, start, length, length, nmatch, pmatch, eflags); __libc_lock_unlock (dfa->lock); return err != REG_NOERROR; @@ -267,7 +271,7 @@ compat_symbol (libc, __compat_regexec, r the first STOP characters of the concatenation of the strings should be concerned. - If REGS is not NULL, and BUFP->no_sub is not set, the offsets of the match + If REGS is not NULL, and BUFP->re_no_sub is not set, the offsets of the match and all groups is stroed in REGS. (For the "_2" variants, the offsets are computed relative to the concatenation, not relative to the individual strings.) @@ -276,80 +280,80 @@ compat_symbol (libc, __compat_regexec, r return the position of the start of the match. Return value -1 means no match was found and -2 indicates an internal error. */ -int +regoff_t re_match (struct re_pattern_buffer *bufp, const char *string, - int length, int start, struct re_registers *regs) + Idx length, Idx start, struct re_registers *regs) { - return re_search_stub (bufp, string, length, start, 0, length, regs, 1); + return re_search_stub (bufp, string, length, start, 0, length, regs, true); } #ifdef _LIBC weak_alias (__re_match, re_match) #endif -int +regoff_t re_search (struct re_pattern_buffer *bufp, const char *string, - int length, int start, int range, struct re_registers *regs) + Idx length, Idx start, regoff_t range, struct re_registers *regs) { - return re_search_stub (bufp, string, length, start, range, length, regs, 0); + return re_search_stub (bufp, string, length, start, range, length, regs, + false); } #ifdef _LIBC weak_alias (__re_search, re_search) #endif -int +regoff_t re_match_2 (struct re_pattern_buffer *bufp, - const char *string1, int length1, - const char *string2, int length2, - int start, struct re_registers *regs, int stop) + const char *string1, Idx length1, + const char *string2, Idx length2, + Idx start, struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, - start, 0, regs, stop, 1); + start, 0, regs, stop, true); } #ifdef _LIBC weak_alias (__re_match_2, re_match_2) #endif -int +regoff_t re_search_2 (struct re_pattern_buffer *bufp, - const char *string1, int length1, - const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop) + const char *string1, Idx length1, + const char *string2, Idx length2, + Idx start, regoff_t range, struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, - start, range, regs, stop, 0); + start, range, regs, stop, false); } #ifdef _LIBC weak_alias (__re_search_2, re_search_2) #endif -static int +static regoff_t internal_function re_search_2_stub (struct re_pattern_buffer *bufp, - const char *string1, int length1, - const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop, - int ret_len) + const char *string1, Idx length1, + const char *string2, Idx length2, + Idx start, regoff_t range, struct re_registers *regs, + Idx stop, bool ret_len) { const char *str; - int rval; - int len = length1 + length2; - int free_str = 0; + regoff_t rval; + Idx len = length1 + length2; + char *s = NULL; - if (BE (length1 < 0 || length2 < 0 || stop < 0, 0)) + if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0)) return -2; /* Concatenate the strings. */ if (length2 > 0) if (length1 > 0) { - char *s = re_malloc (char, len); + s = re_malloc (char, len); if (BE (s == NULL, 0)) return -2; memcpy (s, string1, length1); memcpy (s + length1, string2, length2); str = s; - free_str = 1; } else str = string2; @@ -358,58 +362,81 @@ re_search_2_stub (struct re_pattern_buff rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len); - if (free_str) - re_free ((char *) str); + re_free (s); return rval; } /* The parameters have the same meaning as those of re_search. Additional parameters: - If RET_LEN is nonzero the length of the match is returned (re_match style); + If RET_LEN is true the length of the match is returned (re_match style); otherwise the position of the match is returned. */ -static int +static regoff_t internal_function re_search_stub (struct re_pattern_buffer *bufp, - const char *string, int length, - int start, int range, int stop, struct re_registers *regs, - int ret_len) + const char *string, Idx length, + Idx start, regoff_t range, Idx stop, struct re_registers *regs, + bool ret_len) { reg_errcode_t result; regmatch_t *pmatch; - int nregs, rval; + Idx nregs; + regoff_t rval; int eflags = 0; #ifdef _LIBC - re_dfa_t *dfa = (re_dfa_t *)bufp->buffer; + re_dfa_t *dfa = (re_dfa_t *) bufp->re_buffer; #endif + Idx last_start = start + range; /* Check for out-of-range. */ if (BE (start < 0 || start > length, 0)) return -1; - if (BE (start + range > length, 0)) - range = length - start; - else if (BE (start + range < 0, 0)) - range = -start; + if (sizeof start < sizeof range) + { + regoff_t length_offset = length; + regoff_t start_offset = start; + if (BE (length_offset - start_offset < range, 0)) + last_start = length; + else if (BE (range < - start_offset, 0)) + last_start = 0; + } + else + { + if (BE ((last_start < start) != (range < 0), 0)) + { + /* Overflow occurred when computing last_start; substitute + the extreme value. */ + last_start = range < 0 ? 0 : length; + } + else + { + if (BE (length < last_start, 0)) + last_start = length; + else if (BE (last_start < 0, 0)) + last_start = 0; + } + } __libc_lock_lock (dfa->lock); - eflags |= (bufp->not_bol) ? REG_NOTBOL : 0; - eflags |= (bufp->not_eol) ? REG_NOTEOL : 0; + eflags |= (bufp->re_not_bol) ? REG_NOTBOL : 0; + eflags |= (bufp->re_not_eol) ? REG_NOTEOL : 0; /* Compile fastmap if we haven't yet. */ - if (range > 0 && bufp->fastmap != NULL && !bufp->fastmap_accurate) + if (start < last_start && bufp->re_fastmap != NULL + && !bufp->re_fastmap_accurate) re_compile_fastmap (bufp); - if (BE (bufp->no_sub, 0)) + if (BE (bufp->re_no_sub, 0)) regs = NULL; /* We need at least 1 register. */ if (regs == NULL) nregs = 1; - else if (BE (bufp->regs_allocated == REGS_FIXED && - regs->num_regs < bufp->re_nsub + 1, 0)) + else if (BE (bufp->re_regs_allocated == REG_FIXED + && regs->rm_num_regs <= bufp->re_nsub, 0)) { - nregs = regs->num_regs; + nregs = regs->rm_num_regs; if (BE (nregs < 1, 0)) { /* Nothing can be copied to regs. */ @@ -419,14 +446,14 @@ re_search_stub (struct re_pattern_buffer } else nregs = bufp->re_nsub + 1; - pmatch = re_malloc (regmatch_t, nregs); + pmatch = re_xmalloc (regmatch_t, nregs); if (BE (pmatch == NULL, 0)) { rval = -2; goto out; } - result = re_search_internal (bufp, string, length, start, range, stop, + result = re_search_internal (bufp, string, length, start, last_start, stop, nregs, pmatch, eflags); rval = 0; @@ -437,9 +464,9 @@ re_search_stub (struct re_pattern_buffer else if (regs != NULL) { /* If caller wants register contents data back, copy them. */ - bufp->regs_allocated = re_copy_regs (regs, pmatch, nregs, - bufp->regs_allocated); - if (BE (bufp->regs_allocated == REGS_UNALLOCATED, 0)) + bufp->re_regs_allocated = re_copy_regs (regs, pmatch, nregs, + bufp->re_regs_allocated); + if (BE (bufp->re_regs_allocated == REG_UNALLOCATED, 0)) rval = -2; } @@ -461,55 +488,56 @@ re_search_stub (struct re_pattern_buffer static unsigned internal_function -re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, int nregs, +re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { - int rval = REGS_REALLOCATE; - int i; - int need_regs = nregs + 1; - /* We need one extra element beyond `num_regs' for the `-1' marker GNU code + int rval = REG_REALLOCATE; + Idx i; + Idx need_regs = nregs + 1; + /* We need one extra element beyond `rm_num_regs' for the `-1' marker GNU code uses. */ /* Have the register data arrays been allocated? */ - if (regs_allocated == REGS_UNALLOCATED) + if (regs_allocated == REG_UNALLOCATED) { /* No. So allocate them with malloc. */ - regs->start = re_malloc (regoff_t, need_regs); - regs->end = re_malloc (regoff_t, need_regs); - if (BE (regs->start == NULL, 0) || BE (regs->end == NULL, 0)) - return REGS_UNALLOCATED; - regs->num_regs = need_regs; + regs->rm_start = re_xmalloc (regoff_t, need_regs); + regs->rm_end = re_malloc (regoff_t, need_regs); + if (BE (regs->rm_start == NULL, 0) || BE (regs->rm_end == NULL, 0)) + return REG_UNALLOCATED; + regs->rm_num_regs = need_regs; } - else if (regs_allocated == REGS_REALLOCATE) + else if (regs_allocated == REG_REALLOCATE) { /* Yes. If we need more elements than were already allocated, reallocate them. If we need fewer, just leave it alone. */ - if (BE (need_regs > regs->num_regs, 0)) + if (BE (need_regs > regs->rm_num_regs, 0)) { - regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs); - regoff_t *new_end = re_realloc (regs->end, regoff_t, need_regs); + regoff_t *new_start = + re_xrealloc (regs->rm_start, regoff_t, need_regs); + regoff_t *new_end = re_realloc (regs->rm_end, regoff_t, need_regs); if (BE (new_start == NULL, 0) || BE (new_end == NULL, 0)) - return REGS_UNALLOCATED; - regs->start = new_start; - regs->end = new_end; - regs->num_regs = need_regs; + return REG_UNALLOCATED; + regs->rm_start = new_start; + regs->rm_end = new_end; + regs->rm_num_regs = need_regs; } } else { - assert (regs_allocated == REGS_FIXED); - /* This function may not be called with REGS_FIXED and nregs too big. */ - assert (regs->num_regs >= nregs); - rval = REGS_FIXED; + assert (regs_allocated == REG_FIXED); + /* This function may not be called with REG_FIXED and nregs too big. */ + assert (regs->rm_num_regs >= nregs); + rval = REG_FIXED; } /* Copy the regs. */ for (i = 0; i < nregs; ++i) { - regs->start[i] = pmatch[i].rm_so; - regs->end[i] = pmatch[i].rm_eo; + regs->rm_start[i] = pmatch[i].rm_so; + regs->rm_end[i] = pmatch[i].rm_eo; } - for ( ; i < regs->num_regs; ++i) - regs->start[i] = regs->end[i] = -1; + for ( ; i < regs->rm_num_regs; ++i) + regs->rm_start[i] = regs->rm_end[i] = -1; return rval; } @@ -529,20 +557,20 @@ re_copy_regs (struct re_registers *regs, void re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, - unsigned int num_regs, regoff_t *starts, regoff_t *ends) + __re_size_t num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { - bufp->regs_allocated = REGS_REALLOCATE; - regs->num_regs = num_regs; - regs->start = starts; - regs->end = ends; + bufp->re_regs_allocated = REG_REALLOCATE; + regs->rm_num_regs = num_regs; + regs->rm_start = starts; + regs->rm_end = ends; } else { - bufp->regs_allocated = REGS_UNALLOCATED; - regs->num_regs = 0; - regs->start = regs->end = (regoff_t *) 0; + bufp->re_regs_allocated = REG_UNALLOCATED; + regs->rm_num_regs = 0; + regs->rm_start = regs->rm_end = NULL; } } #ifdef _LIBC @@ -557,8 +585,7 @@ int # ifdef _LIBC weak_function # endif -re_exec (s) - const char *s; +re_exec (const char *s) { return 0 == regexec (&re_comp_buf, s, 0, NULL, 0); } @@ -568,35 +595,41 @@ re_exec (s) /* Searches for a compiled pattern PREG in the string STRING, whose length is LENGTH. NMATCH, PMATCH, and EFLAGS have the same - mingings with regexec. START, and RANGE have the same meanings - with re_search. + meaning as with regexec. LAST_START is START + RANGE, where + START and RANGE have the same meaning as with re_search. Return REG_NOERROR if we find a match, and REG_NOMATCH if not, otherwise return the error code. Note: We assume front end functions already check ranges. - (START + RANGE >= 0 && START + RANGE <= LENGTH) */ + (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t internal_function re_search_internal (const regex_t *preg, - const char *string, int length, - int start, int range, int stop, + const char *string, Idx length, + Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; - int left_lim, right_lim, incr; - int fl_longest_match, match_first, match_kind, match_last = -1; - int extra_nmatch; - int sb, ch; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; + Idx left_lim, right_lim; + int incr; + bool fl_longest_match; + int match_kind; + Idx match_first, match_last = REG_MISSING; + Idx extra_nmatch; + bool sb; + int ch; #if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) re_match_context_t mctx = { .dfa = dfa }; #else re_match_context_t mctx; #endif - char *fastmap = (preg->fastmap != NULL && preg->fastmap_accurate - && range && !preg->can_be_null) ? preg->fastmap : NULL; - unsigned RE_TRANSLATE_TYPE t = (unsigned RE_TRANSLATE_TYPE) preg->translate; + char *fastmap = ((preg->re_fastmap != NULL && preg->re_fastmap_accurate + && start != last_start && !preg->re_can_be_null) + ? preg->re_fastmap : NULL); + unsigned REG_TRANSLATE_TYPE t = + (unsigned REG_TRANSLATE_TYPE) preg->re_translate; #if !(defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) memset (&mctx, '\0', sizeof (re_match_context_t)); @@ -607,39 +640,40 @@ re_search_internal (const regex_t *preg, nmatch -= extra_nmatch; /* Check if the DFA haven't been compiled. */ - if (BE (preg->used == 0 || dfa->init_state == NULL + if (BE (preg->re_used == 0 || dfa->init_state == NULL || dfa->init_state_word == NULL || dfa->init_state_nl == NULL || dfa->init_state_begbuf == NULL, 0)) return REG_NOMATCH; #ifdef DEBUG /* We assume front-end functions already check them. */ - assert (start + range >= 0 && start + range <= length); + assert (0 <= last_start && last_start <= length); #endif /* If initial states with non-begbuf contexts have no elements, - the regex must be anchored. If preg->newline_anchor is set, + the regex must be anchored. If preg->re_newline_anchor is set, we'll never use init_state_nl, so do not check it. */ if (dfa->init_state->nodes.nelem == 0 && dfa->init_state_word->nodes.nelem == 0 && (dfa->init_state_nl->nodes.nelem == 0 - || !preg->newline_anchor)) + || !preg->re_newline_anchor)) { - if (start != 0 && start + range != 0) + if (start != 0 && last_start != 0) return REG_NOMATCH; - start = range = 0; + start = last_start = 0; } /* We must check the longest matching, if nmatch > 0. */ fl_longest_match = (nmatch != 0 || dfa->nbackref); err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1, - preg->translate, preg->syntax & RE_ICASE, dfa); + preg->re_translate, + preg->re_syntax & REG_IGNORE_CASE, dfa); if (BE (err != REG_NOERROR, 0)) goto free_return; mctx.input.stop = stop; mctx.input.raw_stop = stop; - mctx.input.newline_anchor = preg->newline_anchor; + mctx.input.newline_anchor = preg->re_newline_anchor; err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2); if (BE (err != REG_NOERROR, 0)) @@ -651,7 +685,7 @@ re_search_internal (const regex_t *preg, multi character collating element. */ if (nmatch > 1 || dfa->has_mb_node) { - mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1); + mctx.state_log = re_xmalloc (re_dfastate_t *, mctx.input.bufs_len + 1); if (BE (mctx.state_log == NULL, 0)) { err = REG_ESPACE; @@ -666,14 +700,14 @@ re_search_internal (const regex_t *preg, : CONTEXT_NEWLINE | CONTEXT_BEGBUF; /* Check incrementally whether of not the input string match. */ - incr = (range < 0) ? -1 : 1; - left_lim = (range < 0) ? start + range : start; - right_lim = (range < 0) ? start : start + range; + incr = (last_start < start) ? -1 : 1; + left_lim = (last_start < start) ? last_start : start; + right_lim = (last_start < start) ? start : last_start; sb = dfa->mb_cur_max == 1; match_kind = (fastmap - ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0) - | (range >= 0 ? 2 : 0) + ? ((sb || !(preg->re_syntax & REG_IGNORE_CASE || t) ? 4 : 0) + | (start <= last_start ? 2 : 0) | (t != NULL ? 1 : 0)) : 8); @@ -740,8 +774,8 @@ re_search_internal (const regex_t *preg, { /* If MATCH_FIRST is out of the valid range, reconstruct the buffers. */ - unsigned int offset = match_first - mctx.input.raw_mbs_idx; - if (BE (offset >= (unsigned int) mctx.input.valid_raw_len, 0)) + __re_size_t offset = match_first - mctx.input.raw_mbs_idx; + if (BE (offset >= (__re_size_t) mctx.input.valid_raw_len, 0)) { err = re_string_reconstruct (&mctx.input, match_first, eflags); @@ -783,10 +817,10 @@ re_search_internal (const regex_t *preg, /* We assume that the matching starts from 0. */ mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0; match_last = check_matching (&mctx, fl_longest_match, - range >= 0 ? &match_first : NULL); - if (match_last != -1) + start <= last_start ? &match_first : NULL); + if (match_last != REG_MISSING) { - if (BE (match_last == -2, 0)) + if (BE (match_last == REG_ERROR, 0)) { err = REG_ESPACE; goto free_return; @@ -794,13 +828,13 @@ re_search_internal (const regex_t *preg, else { mctx.match_last = match_last; - if ((!preg->no_sub && nmatch > 1) || dfa->nbackref) + if ((!preg->re_no_sub && nmatch > 1) || dfa->nbackref) { re_dfastate_t *pstate = mctx.state_log[match_last]; mctx.last_node = check_halt_state_context (&mctx, pstate, match_last); } - if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match) + if ((!preg->re_no_sub && nmatch > 1 && dfa->has_plural_match) || dfa->nbackref) { err = prune_impossible_nodes (&mctx); @@ -808,7 +842,7 @@ re_search_internal (const regex_t *preg, break; if (BE (err != REG_NOMATCH, 0)) goto free_return; - match_last = -1; + match_last = REG_MISSING; } else break; /* We found a match. */ @@ -819,14 +853,14 @@ re_search_internal (const regex_t *preg, } #ifdef DEBUG - assert (match_last != -1); + assert (match_last != REG_MISSING); assert (err == REG_NOERROR); #endif /* Set pmatch[] if we need. */ if (nmatch > 0) { - int reg_idx; + Idx reg_idx; /* Initialize registers. */ for (reg_idx = 1; reg_idx < nmatch; ++reg_idx) @@ -835,8 +869,11 @@ re_search_internal (const regex_t *preg, /* Set the points where matching start/end. */ pmatch[0].rm_so = 0; pmatch[0].rm_eo = mctx.match_last; + /* FIXME: This function should fail if mctx.match_last exceeds + the maximum possible regoff_t value. We need a new error + code REG_OVERFLOW. */ - if (!preg->no_sub && nmatch > 1) + if (!preg->re_no_sub && nmatch > 1) { err = set_regs (preg, &mctx, nmatch, pmatch, dfa->has_plural_match && dfa->nbackref > 0); @@ -853,14 +890,14 @@ re_search_internal (const regex_t *preg, #ifdef RE_ENABLE_I18N if (BE (mctx.input.offsets_needed != 0, 0)) { - if (pmatch[reg_idx].rm_so == mctx.input.valid_len) - pmatch[reg_idx].rm_so += mctx.input.valid_raw_len - mctx.input.valid_len; - else - pmatch[reg_idx].rm_so = mctx.input.offsets[pmatch[reg_idx].rm_so]; - if (pmatch[reg_idx].rm_eo == mctx.input.valid_len) - pmatch[reg_idx].rm_eo += mctx.input.valid_raw_len - mctx.input.valid_len; - else - pmatch[reg_idx].rm_eo = mctx.input.offsets[pmatch[reg_idx].rm_eo]; + pmatch[reg_idx].rm_so = + (pmatch[reg_idx].rm_so == mctx.input.valid_len + ? mctx.input.valid_raw_len + : mctx.input.offsets[pmatch[reg_idx].rm_so]); + pmatch[reg_idx].rm_eo = + (pmatch[reg_idx].rm_eo == mctx.input.valid_len + ? mctx.input.valid_raw_len + : mctx.input.offsets[pmatch[reg_idx].rm_eo]); } #else assert (mctx.input.offsets_needed == 0); @@ -898,7 +935,7 @@ internal_function prune_impossible_nodes (re_match_context_t *mctx) { re_dfa_t *const dfa = mctx->dfa; - int halt_node, match_last; + Idx halt_node, match_last; reg_errcode_t ret; re_dfastate_t **sifted_states; re_dfastate_t **lim_states = NULL; @@ -908,7 +945,7 @@ prune_impossible_nodes (re_match_context #endif match_last = mctx->match_last; halt_node = mctx->last_node; - sifted_states = re_malloc (re_dfastate_t *, match_last + 1); + sifted_states = re_xmalloc (re_dfastate_t *, match_last + 1); if (BE (sifted_states == NULL, 0)) { ret = REG_ESPACE; @@ -916,7 +953,7 @@ prune_impossible_nodes (re_match_context } if (dfa->nbackref) { - lim_states = re_malloc (re_dfastate_t *, match_last + 1); + lim_states = re_xmalloc (re_dfastate_t *, match_last + 1); if (BE (lim_states == NULL, 0)) { ret = REG_ESPACE; @@ -937,7 +974,7 @@ prune_impossible_nodes (re_match_context do { --match_last; - if (match_last < 0) + if (! REG_VALID_INDEX (match_last)) { ret = REG_NOMATCH; goto free_return; @@ -982,7 +1019,7 @@ prune_impossible_nodes (re_match_context static inline re_dfastate_t * __attribute ((always_inline)) internal_function acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, - int idx) + Idx idx) { re_dfa_t *const dfa = mctx->dfa; if (dfa->init_state->has_constraint) @@ -1013,27 +1050,27 @@ acquire_init_state_context (reg_errcode_ } /* Check whether the regular expression match input string INPUT or not, - and return the index where the matching end, return -1 if not match, - or return -2 in case of an error. + and return the index where the matching end. Return REG_MISSING if + there is no match, and return REG_ERROR in case of an error. FL_LONGEST_MATCH means we want the POSIX longest matching. If P_MATCH_FIRST is not NULL, and the match fails, it is set to the next place where we may want to try matching. Note that the matcher assume that the maching starts from the current index of the buffer. */ -static int +static Idx internal_function -check_matching (re_match_context_t *mctx, int fl_longest_match, - int *p_match_first) +check_matching (re_match_context_t *mctx, bool fl_longest_match, + Idx *p_match_first) { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int match = 0; - int match_last = -1; - int cur_str_idx = re_string_cur_idx (&mctx->input); + Idx match = 0; + Idx match_last = REG_MISSING; + Idx cur_str_idx = re_string_cur_idx (&mctx->input); re_dfastate_t *cur_state; - int at_init_state = p_match_first != NULL; - int next_start_idx = cur_str_idx; + bool at_init_state = p_match_first != NULL; + Idx next_start_idx = cur_str_idx; err = REG_NOERROR; cur_state = acquire_init_state_context (&err, mctx, cur_str_idx); @@ -1041,7 +1078,7 @@ check_matching (re_match_context_t *mctx if (BE (cur_state == NULL, 0)) { assert (err == REG_ESPACE); - return -2; + return REG_ERROR; } if (mctx->state_log != NULL) @@ -1052,7 +1089,7 @@ check_matching (re_match_context_t *mctx later. E.g. Processing back references. */ if (BE (dfa->nbackref, 0)) { - at_init_state = 0; + at_init_state = false; err = check_subexp_matching_top (mctx, &cur_state->nodes, 0); if (BE (err != REG_NOERROR, 0)) return err; @@ -1085,7 +1122,7 @@ check_matching (re_match_context_t *mctx while (!re_string_eoi (&mctx->input)) { re_dfastate_t *old_state = cur_state; - int next_char_idx = re_string_cur_idx (&mctx->input) + 1; + Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1; if (BE (next_char_idx >= mctx->input.bufs_len, 0) || (BE (next_char_idx >= mctx->input.valid_len, 0) @@ -1095,7 +1132,7 @@ check_matching (re_match_context_t *mctx if (BE (err != REG_NOERROR, 0)) { assert (err == REG_ESPACE); - return -2; + return REG_ERROR; } } @@ -1109,7 +1146,7 @@ check_matching (re_match_context_t *mctx state using the state log, if available and if we have not already found a valid (even if not the longest) match. */ if (BE (err != REG_NOERROR, 0)) - return -2; + return REG_ERROR; if (mctx->state_log == NULL || (match && !fl_longest_match) @@ -1122,7 +1159,7 @@ check_matching (re_match_context_t *mctx if (old_state == cur_state) next_start_idx = next_char_idx; else - at_init_state = 0; + at_init_state = false; } if (cur_state->halt) @@ -1153,31 +1190,31 @@ check_matching (re_match_context_t *mctx /* Check NODE match the current context. */ -static int +static bool internal_function -check_halt_node_context (const re_dfa_t *dfa, int node, unsigned int context) +check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context) { re_token_type_t type = dfa->nodes[node].type; unsigned int constraint = dfa->nodes[node].constraint; if (type != END_OF_RE) - return 0; + return false; if (!constraint) - return 1; + return true; if (NOT_SATISFY_NEXT_CONSTRAINT (constraint, context)) - return 0; - return 1; + return false; + return true; } /* Check the halt state STATE match the current context. Return 0 if not match, if the node, STATE has, is a halt node and match the context, return the node. */ -static int +static Idx internal_function check_halt_state_context (const re_match_context_t *mctx, - const re_dfastate_t *state, int idx) + const re_dfastate_t *state, Idx idx) { - int i; + Idx i; unsigned int context; #ifdef DEBUG assert (state->halt); @@ -1191,32 +1228,34 @@ check_halt_state_context (const re_match /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA corresponding to the DFA). - Return the destination node, and update EPS_VIA_NODES, return -1 in case - of errors. */ + Return the destination node, and update EPS_VIA_NODES; + return REG_MISSING in case of errors. */ -static int +static Idx internal_function proceed_next_node (const re_match_context_t *mctx, - int nregs, regmatch_t *regs, int *pidx, int node, + Idx nregs, regmatch_t *regs, Idx *pidx, Idx node, re_node_set *eps_via_nodes, struct re_fail_stack_t *fs) { re_dfa_t *const dfa = mctx->dfa; - int i, err; + Idx i; + bool ok; if (IS_EPSILON_NODE (dfa->nodes[node].type)) { re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes; re_node_set *edests = &dfa->edests[node]; - int dest_node; - err = re_node_set_insert (eps_via_nodes, node); - if (BE (err < 0, 0)) - return -2; - /* Pick up a valid destination, or return -1 if none is found. */ - for (dest_node = -1, i = 0; i < edests->nelem; ++i) + Idx dest_node; + ok = re_node_set_insert (eps_via_nodes, node); + if (BE (! ok, 0)) + return REG_ERROR; + /* Pick up a valid destination, or return REG_MISSING if none + is found. */ + for (dest_node = REG_MISSING, i = 0; i < edests->nelem; ++i) { - int candidate = edests->elems[i]; + Idx candidate = edests->elems[i]; if (!re_node_set_contains (cur_nodes, candidate)) continue; - if (dest_node == -1) + if (dest_node == REG_MISSING) dest_node = candidate; else @@ -1230,7 +1269,7 @@ proceed_next_node (const re_match_contex else if (fs != NULL && push_fail_stack (fs, *pidx, candidate, nregs, regs, eps_via_nodes)) - return -2; + return REG_ERROR; /* We know we are going to exit. */ break; @@ -1240,7 +1279,7 @@ proceed_next_node (const re_match_contex } else { - int naccepted = 0; + Idx naccepted = 0; re_token_type_t type = dfa->nodes[node].type; #ifdef RE_ENABLE_I18N @@ -1250,27 +1289,27 @@ proceed_next_node (const re_match_contex #endif /* RE_ENABLE_I18N */ if (type == OP_BACK_REF) { - int subexp_idx = dfa->nodes[node].opr.idx + 1; + Idx subexp_idx = dfa->nodes[node].opr.idx + 1; naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so; if (fs != NULL) { if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1) - return -1; + return REG_MISSING; else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, naccepted) != 0) - return -1; + return REG_MISSING; } } if (naccepted == 0) { - int dest_node; - err = re_node_set_insert (eps_via_nodes, node); - if (BE (err < 0, 0)) - return -2; + Idx dest_node; + ok = re_node_set_insert (eps_via_nodes, node); + if (BE (! ok, 0)) + return REG_ERROR; dest_node = dfa->edests[node].elems[0]; if (re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node)) @@ -1281,39 +1320,37 @@ proceed_next_node (const re_match_contex if (naccepted != 0 || check_node_accept (mctx, dfa->nodes + node, *pidx)) { - int dest_node = dfa->nexts[node]; + Idx dest_node = dfa->nexts[node]; *pidx = (naccepted == 0) ? *pidx + 1 : *pidx + naccepted; if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL || !re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node))) - return -1; + return REG_MISSING; re_node_set_empty (eps_via_nodes); return dest_node; } } - return -1; + return REG_MISSING; } static reg_errcode_t internal_function -push_fail_stack (struct re_fail_stack_t *fs, int str_idx, int dest_node, - int nregs, regmatch_t *regs, re_node_set *eps_via_nodes) +push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, + Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { reg_errcode_t err; - int num = fs->num++; + Idx num = fs->num++; if (fs->num == fs->alloc) { - struct re_fail_stack_ent_t *new_array; - new_array = realloc (fs->stack, (sizeof (struct re_fail_stack_ent_t) - * fs->alloc * 2)); + struct re_fail_stack_ent_t *new_array = + re_x2realloc (fs->stack, struct re_fail_stack_ent_t, &fs->alloc); if (new_array == NULL) return REG_ESPACE; - fs->alloc *= 2; fs->stack = new_array; } fs->stack[num].idx = str_idx; fs->stack[num].node = dest_node; - fs->stack[num].regs = re_malloc (regmatch_t, nregs); + fs->stack[num].regs = re_xmalloc (regmatch_t, nregs); if (fs->stack[num].regs == NULL) return REG_ESPACE; memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs); @@ -1321,13 +1358,13 @@ push_fail_stack (struct re_fail_stack_t return err; } -static int +static Idx internal_function -pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, - int nregs, regmatch_t *regs, re_node_set *eps_via_nodes) +pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, + Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { - int num = --fs->num; - assert (num >= 0); + Idx num = --fs->num; + assert (REG_VALID_INDEX (num)); *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); @@ -1344,14 +1381,15 @@ pop_fail_stack (struct re_fail_stack_t * static reg_errcode_t internal_function set_regs (const regex_t *preg, const re_match_context_t *mctx, - size_t nmatch, regmatch_t *pmatch, int fl_backtrack) + size_t nmatch, regmatch_t *pmatch, bool fl_backtrack) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; - int idx, cur_node; + re_dfa_t *dfa = (re_dfa_t *) preg->re_buffer; + Idx idx, cur_node; re_node_set eps_via_nodes; struct re_fail_stack_t *fs; struct re_fail_stack_t fs_body = { 0, 2, NULL }; regmatch_t *prev_idx_match; + bool prev_idx_match_malloced = false; #ifdef DEBUG assert (nmatch > 1); @@ -1360,7 +1398,7 @@ set_regs (const regex_t *preg, const re_ if (fl_backtrack) { fs = &fs_body; - fs->stack = re_malloc (struct re_fail_stack_ent_t, fs->alloc); + fs->stack = re_xmalloc (struct re_fail_stack_ent_t, fs->alloc); if (fs->stack == NULL) return REG_ESPACE; } @@ -1370,7 +1408,23 @@ set_regs (const regex_t *preg, const re_ cur_node = dfa->init_node; re_node_set_init_empty (&eps_via_nodes); - prev_idx_match = (regmatch_t *) alloca (sizeof (regmatch_t) * nmatch); + if (re_alloc_oversized (nmatch, sizeof (regmatch_t))) + { + free_fail_stack_return (fs); + return REG_ESPACE; + } + if (__libc_use_alloca (nmatch * sizeof (regmatch_t))) + prev_idx_match = (regmatch_t *) alloca (nmatch * sizeof (regmatch_t)); + else + { + prev_idx_match = re_malloc (regmatch_t, nmatch); + if (prev_idx_match == NULL) + { + free_fail_stack_return (fs); + return REG_ESPACE; + } + prev_idx_match_malloced = true; + } memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) @@ -1379,7 +1433,7 @@ set_regs (const regex_t *preg, const re_ if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) { - int reg_idx; + Idx reg_idx; if (fs) { for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) @@ -1388,6 +1442,8 @@ set_regs (const regex_t *preg, const re_ if (reg_idx == nmatch) { re_node_set_free (&eps_via_nodes); + if (prev_idx_match_malloced) + re_free (prev_idx_match); return free_fail_stack_return (fs); } cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, @@ -1396,6 +1452,8 @@ set_regs (const regex_t *preg, const re_ else { re_node_set_free (&eps_via_nodes); + if (prev_idx_match_malloced) + re_free (prev_idx_match); return REG_NOERROR; } } @@ -1404,11 +1462,13 @@ set_regs (const regex_t *preg, const re_ cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node, &eps_via_nodes, fs); - if (BE (cur_node < 0, 0)) + if (BE (! REG_VALID_INDEX (cur_node), 0)) { - if (BE (cur_node == -2, 0)) + if (BE (cur_node == REG_ERROR, 0)) { re_node_set_free (&eps_via_nodes); + if (prev_idx_match_malloced) + re_free (prev_idx_match); free_fail_stack_return (fs); return REG_ESPACE; } @@ -1418,11 +1478,15 @@ set_regs (const regex_t *preg, const re_ else { re_node_set_free (&eps_via_nodes); + if (prev_idx_match_malloced) + re_free (prev_idx_match); return REG_NOMATCH; } } } re_node_set_free (&eps_via_nodes); + if (prev_idx_match_malloced) + re_free (prev_idx_match); return free_fail_stack_return (fs); } @@ -1432,7 +1496,7 @@ free_fail_stack_return (struct re_fail_s { if (fs) { - int fs_idx; + Idx fs_idx; for (fs_idx = 0; fs_idx < fs->num; ++fs_idx) { re_node_set_free (&fs->stack[fs_idx].eps_via_nodes); @@ -1446,12 +1510,12 @@ free_fail_stack_return (struct re_fail_s static void internal_function update_regs (re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, - int cur_node, int cur_idx, int nmatch) + Idx cur_node, Idx cur_idx, Idx nmatch) { int type = dfa->nodes[cur_node].type; if (type == OP_OPEN_SUBEXP) { - int reg_num = dfa->nodes[cur_node].opr.idx + 1; + Idx reg_num = dfa->nodes[cur_node].opr.idx + 1; /* We are at the first node of this sub expression. */ if (reg_num < nmatch) @@ -1462,7 +1526,7 @@ update_regs (re_dfa_t *dfa, regmatch_t * } else if (type == OP_CLOSE_SUBEXP) { - int reg_num = dfa->nodes[cur_node].opr.idx + 1; + Idx reg_num = dfa->nodes[cur_node].opr.idx + 1; if (reg_num < nmatch) { /* We are at the last node of this sub expression. */ @@ -1521,7 +1585,7 @@ sift_states_backward (re_match_context_t { reg_errcode_t err; int null_cnt = 0; - int str_idx = sctx->last_str_idx; + Idx str_idx = sctx->last_str_idx; re_node_set cur_dest; #ifdef DEBUG @@ -1576,11 +1640,11 @@ sift_states_backward (re_match_context_t static reg_errcode_t internal_function build_sifted_states (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, re_node_set *cur_dest) + Idx str_idx, re_node_set *cur_dest) { re_dfa_t *const dfa = mctx->dfa; re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes; - int i; + Idx i; /* Then build the next sifted state. We build the next sifted state on `cur_dest', and update @@ -1591,9 +1655,9 @@ build_sifted_states (re_match_context_t (with the epsilon nodes pre-filtered out). */ for (i = 0; i < cur_src->nelem; i++) { - int prev_node = cur_src->elems[i]; + Idx prev_node = cur_src->elems[i]; int naccepted = 0; - int ret; + bool ok; #ifdef DEBUG re_token_type_t type = dfa->nodes[prev_node].type; @@ -1619,14 +1683,14 @@ build_sifted_states (re_match_context_t if (sctx->limits.nelem) { - int to_idx = str_idx + naccepted; + Idx to_idx = str_idx + naccepted; if (check_dst_limits (mctx, &sctx->limits, dfa->nexts[prev_node], to_idx, prev_node, str_idx)) continue; } - ret = re_node_set_insert (cur_dest, prev_node); - if (BE (ret == -1, 0)) + ok = re_node_set_insert (cur_dest, prev_node); + if (BE (! ok, 0)) return REG_ESPACE; } @@ -1637,9 +1701,9 @@ build_sifted_states (re_match_context_t static reg_errcode_t internal_function -clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx) +clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx) { - int top = mctx->state_log_top; + Idx top = mctx->state_log_top; if (next_state_log_idx >= mctx->input.bufs_len || (next_state_log_idx >= mctx->input.valid_len @@ -1663,9 +1727,9 @@ clean_state_log_if_needed (re_match_cont static reg_errcode_t internal_function merge_state_array (re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src, - int num) + Idx num) { - int st_idx; + Idx st_idx; reg_errcode_t err; for (st_idx = 0; st_idx < num; ++st_idx) { @@ -1690,7 +1754,7 @@ merge_state_array (re_dfa_t *dfa, re_dfa static reg_errcode_t internal_function update_cur_sifted_state (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, re_node_set *dest_nodes) + Idx str_idx, re_node_set *dest_nodes) { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; @@ -1740,7 +1804,7 @@ add_epsilon_src_nodes (re_dfa_t *dfa, re const re_node_set *candidates) { reg_errcode_t err = REG_NOERROR; - int i; + Idx i; re_dfastate_t *state = re_acquire_state (&err, dfa, dest_nodes); if (BE (err != REG_NOERROR, 0)) @@ -1761,27 +1825,27 @@ add_epsilon_src_nodes (re_dfa_t *dfa, re static reg_errcode_t internal_function -sub_epsilon_src_nodes (re_dfa_t *dfa, int node, re_node_set *dest_nodes, +sub_epsilon_src_nodes (re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, const re_node_set *candidates) { - int ecl_idx; + Idx ecl_idx; reg_errcode_t err; re_node_set *inv_eclosure = dfa->inveclosures + node; re_node_set except_nodes; re_node_set_init_empty (&except_nodes); for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx) { - int cur_node = inv_eclosure->elems[ecl_idx]; + Idx cur_node = inv_eclosure->elems[ecl_idx]; if (cur_node == node) continue; if (IS_EPSILON_NODE (dfa->nodes[cur_node].type)) { - int edst1 = dfa->edests[cur_node].elems[0]; - int edst2 = ((dfa->edests[cur_node].nelem > 1) - ? dfa->edests[cur_node].elems[1] : -1); + Idx edst1 = dfa->edests[cur_node].elems[0]; + Idx edst2 = ((dfa->edests[cur_node].nelem > 1) + ? dfa->edests[cur_node].elems[1] : REG_MISSING); if ((!re_node_set_contains (inv_eclosure, edst1) && re_node_set_contains (dest_nodes, edst1)) - || (edst2 > 0 + || (REG_VALID_NONZERO_INDEX (edst2) && !re_node_set_contains (inv_eclosure, edst2) && re_node_set_contains (dest_nodes, edst2))) { @@ -1797,10 +1861,10 @@ sub_epsilon_src_nodes (re_dfa_t *dfa, in } for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx) { - int cur_node = inv_eclosure->elems[ecl_idx]; + Idx cur_node = inv_eclosure->elems[ecl_idx]; if (!re_node_set_contains (&except_nodes, cur_node)) { - int idx = re_node_set_contains (dest_nodes, cur_node) - 1; + Idx idx = re_node_set_contains (dest_nodes, cur_node) - 1; re_node_set_remove_at (dest_nodes, idx); } } @@ -1808,19 +1872,19 @@ sub_epsilon_src_nodes (re_dfa_t *dfa, in return REG_NOERROR; } -static int +static bool internal_function -check_dst_limits (re_match_context_t *mctx, re_node_set *limits, - int dst_node, int dst_idx, int src_node, int src_idx) +check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, + Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx) { re_dfa_t *const dfa = mctx->dfa; - int lim_idx, src_pos, dst_pos; + Idx lim_idx, src_pos, dst_pos; - int dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx); - int src_bkref_idx = search_cur_bkref_entry (mctx, src_idx); + Idx dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx); + Idx src_bkref_idx = search_cur_bkref_entry (mctx, src_idx); for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx) { - int subexp_idx; + Idx subexp_idx; struct re_backref_cache_entry *ent; ent = mctx->bkref_ents + limits->elems[lim_idx]; subexp_idx = dfa->nodes[ent->node].opr.idx; @@ -1839,40 +1903,42 @@ check_dst_limits (re_match_context_t *mc if (src_pos == dst_pos) continue; /* This is unrelated limitation. */ else - return 1; + return true; } - return 0; + return false; } static int internal_function -check_dst_limits_calc_pos_1 (re_match_context_t *mctx, int boundaries, - int subexp_idx, int from_node, int bkref_idx) +check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, + Idx subexp_idx, Idx from_node, Idx bkref_idx) { re_dfa_t *const dfa = mctx->dfa; re_node_set *eclosures = dfa->eclosures + from_node; - int node_idx; + Idx node_idx; /* Else, we are on the boundary: examine the nodes on the epsilon closure. */ for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx) { - int node = eclosures->elems[node_idx]; + Idx node = eclosures->elems[node_idx]; switch (dfa->nodes[node].type) { case OP_BACK_REF: - if (bkref_idx != -1) + if (bkref_idx != REG_MISSING) { struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx; do { - int dst, cpos; + Idx dst; + int cpos; if (ent->node != node) continue; - if (subexp_idx <= 8 * sizeof (ent->eps_reachable_subexps_map) - && !(ent->eps_reachable_subexps_map & (1 << subexp_idx))) + if (subexp_idx < BITSET_WORD_BITS + && !(ent->eps_reachable_subexps_map + & ((bitset_word) 1 << subexp_idx))) continue; /* Recurse trying to reach the OP_OPEN_SUBEXP and @@ -1898,7 +1964,9 @@ check_dst_limits_calc_pos_1 (re_match_co if (cpos == 0 && (boundaries & 2)) return 0; - ent->eps_reachable_subexps_map &= ~(1 << subexp_idx); + if (subexp_idx < BITSET_WORD_BITS) + ent->eps_reachable_subexps_map &= + ~ ((bitset_word) 1 << subexp_idx); } while (ent++->more); } @@ -1924,8 +1992,9 @@ check_dst_limits_calc_pos_1 (re_match_co static int internal_function -check_dst_limits_calc_pos (re_match_context_t *mctx, int limit, int subexp_idx, - int from_node, int str_idx, int bkref_idx) +check_dst_limits_calc_pos (const re_match_context_t *mctx, + Idx limit, Idx subexp_idx, + Idx from_node, Idx str_idx, Idx bkref_idx) { struct re_backref_cache_entry *lim = mctx->bkref_ents + limit; int boundaries; @@ -1955,14 +2024,14 @@ static reg_errcode_t internal_function check_subexp_limits (re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, - struct re_backref_cache_entry *bkref_ents, int str_idx) + struct re_backref_cache_entry *bkref_ents, Idx str_idx) { reg_errcode_t err; - int node_idx, lim_idx; + Idx node_idx, lim_idx; for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx) { - int subexp_idx; + Idx subexp_idx; struct re_backref_cache_entry *ent; ent = bkref_ents + limits->elems[lim_idx]; @@ -1972,11 +2041,11 @@ check_subexp_limits (re_dfa_t *dfa, re_n subexp_idx = dfa->nodes[ent->node].opr.idx; if (ent->subexp_to == str_idx) { - int ops_node = -1; - int cls_node = -1; + Idx ops_node = REG_MISSING; + Idx cls_node = REG_MISSING; for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { - int node = dest_nodes->elems[node_idx]; + Idx node = dest_nodes->elems[node_idx]; re_token_type_t type = dfa->nodes[node].type; if (type == OP_OPEN_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx) @@ -1988,7 +2057,7 @@ check_subexp_limits (re_dfa_t *dfa, re_n /* Check the limitation of the open subexpression. */ /* Note that (ent->subexp_to = str_idx != ent->subexp_from). */ - if (ops_node >= 0) + if (REG_VALID_INDEX (ops_node)) { err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes, candidates); @@ -1997,10 +2066,10 @@ check_subexp_limits (re_dfa_t *dfa, re_n } /* Check the limitation of the close subexpression. */ - if (cls_node >= 0) + if (REG_VALID_INDEX (cls_node)) for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { - int node = dest_nodes->elems[node_idx]; + Idx node = dest_nodes->elems[node_idx]; if (!re_node_set_contains (dfa->inveclosures + node, cls_node) && !re_node_set_contains (dfa->eclosures + node, @@ -2020,7 +2089,7 @@ check_subexp_limits (re_dfa_t *dfa, re_n { for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { - int node = dest_nodes->elems[node_idx]; + Idx node = dest_nodes->elems[node_idx]; re_token_type_t type = dfa->nodes[node].type; if (type == OP_CLOSE_SUBEXP || type == OP_OPEN_SUBEXP) { @@ -2042,22 +2111,22 @@ check_subexp_limits (re_dfa_t *dfa, re_n static reg_errcode_t internal_function sift_states_bkref (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, const re_node_set *candidates) + Idx str_idx, const re_node_set *candidates) { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int node_idx, node; + Idx node_idx, node; re_sift_context_t local_sctx; - int first_idx = search_cur_bkref_entry (mctx, str_idx); + Idx first_idx = search_cur_bkref_entry (mctx, str_idx); - if (first_idx == -1) + if (first_idx == REG_MISSING) return REG_NOERROR; local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized. */ for (node_idx = 0; node_idx < candidates->nelem; ++node_idx) { - int enabled_idx; + Idx enabled_idx; re_token_type_t type; struct re_backref_cache_entry *entry; node = candidates->elems[node_idx]; @@ -2072,7 +2141,8 @@ sift_states_bkref (re_match_context_t *m enabled_idx = first_idx; do { - int subexp_len, to_idx, dst_node, ret; + bool ok; + Idx subexp_len, to_idx, dst_node; re_dfastate_t *cur_state; if (entry->node != node) @@ -2098,8 +2168,8 @@ sift_states_bkref (re_match_context_t *m } local_sctx.last_node = node; local_sctx.last_str_idx = str_idx; - ret = re_node_set_insert (&local_sctx.limits, enabled_idx); - if (BE (ret < 0, 0)) + ok = re_node_set_insert (&local_sctx.limits, enabled_idx); + if (BE (! ok, 0)) { err = REG_ESPACE; goto free_return; @@ -2139,7 +2209,7 @@ sift_states_bkref (re_match_context_t *m static int internal_function sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, - int node_idx, int str_idx, int max_str_idx) + Idx node_idx, Idx str_idx, Idx max_str_idx) { re_dfa_t *const dfa = mctx->dfa; int naccepted; @@ -2230,7 +2300,7 @@ merge_state_with_log (reg_errcode_t *err re_dfastate_t *next_state) { re_dfa_t *const dfa = mctx->dfa; - int cur_idx = re_string_cur_idx (&mctx->input); + Idx cur_idx = re_string_cur_idx (&mctx->input); if (cur_idx > mctx->state_log_top) { @@ -2310,8 +2380,8 @@ find_recover_state (reg_errcode_t *err, re_dfastate_t *cur_state = NULL; do { - int max = mctx->state_log_top; - int cur_str_idx = re_string_cur_idx (&mctx->input); + Idx max = mctx->state_log_top; + Idx cur_str_idx = re_string_cur_idx (&mctx->input); do { @@ -2323,7 +2393,7 @@ find_recover_state (reg_errcode_t *err, cur_state = merge_state_with_log (err, mctx, NULL); } - while (err == REG_NOERROR && cur_state == NULL); + while (*err == REG_NOERROR && cur_state == NULL); return cur_state; } @@ -2337,10 +2407,10 @@ find_recover_state (reg_errcode_t *err, static reg_errcode_t internal_function check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, - int str_idx) + Idx str_idx) { re_dfa_t *const dfa = mctx->dfa; - int node_idx; + Idx node_idx; reg_errcode_t err; /* TODO: This isn't efficient. @@ -2350,10 +2420,11 @@ check_subexp_matching_top (re_match_cont E.g. RE: (a){2} */ for (node_idx = 0; node_idx < cur_nodes->nelem; ++node_idx) { - int node = cur_nodes->elems[node_idx]; + Idx node = cur_nodes->elems[node_idx]; if (dfa->nodes[node].type == OP_OPEN_SUBEXP - && dfa->nodes[node].opr.idx < (8 * sizeof (dfa->used_bkref_map)) - && dfa->used_bkref_map & (1 << dfa->nodes[node].opr.idx)) + && dfa->nodes[node].opr.idx < BITSET_WORD_BITS + && (dfa->used_bkref_map + & ((bitset_word) 1 << dfa->nodes[node].opr.idx))) { err = match_ctx_add_subtop (mctx, node, str_idx); if (BE (err != REG_NOERROR, 0)) @@ -2368,15 +2439,13 @@ check_subexp_matching_top (re_match_cont accepting the current input byte. */ static re_dfastate_t * -transit_state_sb (err, mctx, state) - reg_errcode_t *err; - re_match_context_t *mctx; - re_dfastate_t *state; +transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, + re_dfastate_t *state) { re_dfa_t *const dfa = mctx->dfa; re_node_set next_nodes; re_dfastate_t *next_state; - int node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input); + Idx node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input); unsigned int context; *err = re_node_set_alloc (&next_nodes, state->nodes.nelem + 1); @@ -2384,7 +2453,7 @@ transit_state_sb (err, mctx, state) return NULL; for (node_cnt = 0; node_cnt < state->nodes.nelem; ++node_cnt) { - int cur_node = state->nodes.elems[node_cnt]; + Idx cur_node = state->nodes.elems[node_cnt]; if (check_node_accept (mctx, dfa->nodes + cur_node, cur_str_idx)) { *err = re_node_set_merge (&next_nodes, @@ -2414,13 +2483,14 @@ transit_state_mb (re_match_context_t *mc { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int i; + Idx i; for (i = 0; i < pstate->nodes.nelem; ++i) { re_node_set dest_nodes, *new_nodes; - int cur_node_idx = pstate->nodes.elems[i]; - int naccepted, dest_idx; + Idx cur_node_idx = pstate->nodes.elems[i]; + int naccepted; + Idx dest_idx; unsigned int context; re_dfastate_t *dest_state; @@ -2451,7 +2521,7 @@ transit_state_mb (re_match_context_t *mc if (BE (err != REG_NOERROR, 0)) return err; #ifdef DEBUG - assert (dfa->nexts[cur_node_idx] != -1); + assert (dfa->nexts[cur_node_idx] != REG_MISSING); #endif new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; @@ -2483,13 +2553,13 @@ transit_state_bkref (re_match_context_t { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int i; - int cur_str_idx = re_string_cur_idx (&mctx->input); + Idx i; + Idx cur_str_idx = re_string_cur_idx (&mctx->input); for (i = 0; i < nodes->nelem; ++i) { - int dest_str_idx, prev_nelem, bkc_idx; - int node_idx = nodes->elems[i]; + Idx dest_str_idx, prev_nelem, bkc_idx; + Idx node_idx = nodes->elems[i]; unsigned int context; const re_token_t *node = dfa->nodes + node_idx; re_node_set *new_dest_nodes; @@ -2516,11 +2586,11 @@ transit_state_bkref (re_match_context_t /* And add the epsilon closures (which is `new_dest_nodes') of the backreference to appropriate state_log. */ #ifdef DEBUG - assert (dfa->nexts[node_idx] != -1); + assert (dfa->nexts[node_idx] != REG_MISSING); #endif for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx) { - int subexp_len; + Idx subexp_len; re_dfastate_t *dest_state; struct re_backref_cache_entry *bkref_ent; bkref_ent = mctx->bkref_ents + bkc_idx; @@ -2593,14 +2663,14 @@ transit_state_bkref (re_match_context_t static reg_errcode_t internal_function -get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx) +get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) { re_dfa_t *const dfa = mctx->dfa; - int subexp_num, sub_top_idx; + Idx subexp_num, sub_top_idx; const char *buf = (const char *) re_string_get_buffer (&mctx->input); /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX. */ - int cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); - if (cache_idx != -1) + Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); + if (cache_idx != REG_MISSING) { const struct re_backref_cache_entry *entry = mctx->bkref_ents + cache_idx; do @@ -2617,7 +2687,7 @@ get_subexp (re_match_context_t *mctx, in reg_errcode_t err; re_sub_match_top_t *sub_top = mctx->sub_tops[sub_top_idx]; re_sub_match_last_t *sub_last; - int sub_last_idx, sl_str, bkref_str_off; + Idx sub_last_idx, sl_str, bkref_str_off; if (dfa->nodes[sub_top->node].opr.idx != subexp_num) continue; /* It isn't related. */ @@ -2628,7 +2698,7 @@ get_subexp (re_match_context_t *mctx, in evaluated. */ for (sub_last_idx = 0; sub_last_idx < sub_top->nlasts; ++sub_last_idx) { - int sl_str_diff; + regoff_t sl_str_diff; sub_last = sub_top->lasts[sub_last_idx]; sl_str_diff = sub_last->str_idx - sl_str; /* The matched string by the sub expression match with the substring @@ -2673,7 +2743,8 @@ get_subexp (re_match_context_t *mctx, in /* Then, search for the other last nodes of the sub expression. */ for (; sl_str <= bkref_str_idx; ++sl_str) { - int cls_node, sl_str_off; + Idx cls_node; + regoff_t sl_str_off; const re_node_set *nodes; sl_str_off = sl_str - sub_top->str_idx; /* The matched string by the sub expression match with the substring @@ -2701,12 +2772,12 @@ get_subexp (re_match_context_t *mctx, in /* Does this state have a ')' of the sub expression? */ nodes = &mctx->state_log[sl_str]->nodes; cls_node = find_subexp_node (dfa, nodes, subexp_num, OP_CLOSE_SUBEXP); - if (cls_node == -1) + if (cls_node == REG_MISSING) continue; /* No. */ if (sub_top->path == NULL) { - sub_top->path = calloc (sizeof (state_array_t), - sl_str - sub_top->str_idx + 1); + sub_top->path = re_calloc (state_array_t, + sl_str - sub_top->str_idx + 1); if (sub_top->path == NULL) return REG_ESPACE; } @@ -2739,10 +2810,10 @@ get_subexp (re_match_context_t *mctx, in static reg_errcode_t internal_function get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, - re_sub_match_last_t *sub_last, int bkref_node, int bkref_str) + re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str) { reg_errcode_t err; - int to_idx; + Idx to_idx; /* Can the subexpression arrive the back reference? */ err = check_arrival (mctx, &sub_last->path, sub_last->node, sub_last->str_idx, bkref_node, bkref_str, OP_OPEN_SUBEXP); @@ -2764,21 +2835,21 @@ get_subexp_sub (re_match_context_t *mctx nodes. E.g. RE: (a){2} */ -static int +static Idx internal_function find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, - int subexp_idx, int type) + Idx subexp_idx, int type) { - int cls_idx; + Idx cls_idx; for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx) { - int cls_node = nodes->elems[cls_idx]; + Idx cls_node = nodes->elems[cls_idx]; const re_token_t *node = dfa->nodes + cls_node; if (node->type == type && node->opr.idx == subexp_idx) return cls_node; } - return -1; + return REG_MISSING; } /* Check whether the node TOP_NODE at TOP_STR can arrive to the node @@ -2789,12 +2860,12 @@ find_subexp_node (const re_dfa_t *dfa, c static reg_errcode_t internal_function check_arrival (re_match_context_t *mctx, state_array_t *path, - int top_node, int top_str, int last_node, int last_str, + Idx top_node, Idx top_str, Idx last_node, Idx last_str, int type) { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int subexp_num, backup_cur_idx, str_idx, null_cnt; + Idx subexp_num, backup_cur_idx, str_idx, null_cnt; re_dfastate_t *cur_state = NULL; re_node_set *cur_nodes, next_nodes; re_dfastate_t **backup_state_log; @@ -2805,17 +2876,17 @@ check_arrival (re_match_context_t *mctx, if (BE (path->alloc < last_str + mctx->max_mb_elem_len + 1, 0)) { re_dfastate_t **new_array; - int old_alloc = path->alloc; - path->alloc += last_str + mctx->max_mb_elem_len + 1; - new_array = re_realloc (path->array, re_dfastate_t *, path->alloc); - if (new_array == NULL) - { - path->alloc = old_alloc; - return REG_ESPACE; - } + Idx old_alloc = path->alloc; + Idx new_alloc = old_alloc + last_str + mctx->max_mb_elem_len + 1; + if (BE (new_alloc < old_alloc, 0)) + return REG_ESPACE; + new_array = re_xrealloc (path->array, re_dfastate_t *, new_alloc); + if (BE (new_array == NULL, 0)) + return REG_ESPACE; path->array = new_array; + path->alloc = new_alloc; memset (new_array + old_alloc, '\0', - sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); + sizeof (re_dfastate_t *) * (new_alloc - old_alloc)); } str_idx = path->next_idx == 0 ? top_str : path->next_idx; @@ -2949,20 +3020,20 @@ check_arrival (re_match_context_t *mctx, static reg_errcode_t internal_function -check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx, +check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes) { re_dfa_t *const dfa = mctx->dfa; - int result; - int cur_idx; + bool ok; + Idx cur_idx; reg_errcode_t err; re_node_set union_set; re_node_set_init_empty (&union_set); for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx) { int naccepted = 0; - int cur_node = cur_nodes->elems[cur_idx]; + Idx cur_node = cur_nodes->elems[cur_idx]; #ifdef DEBUG re_token_type_t type = dfa->nodes[cur_node].type; assert (!IS_EPSILON_NODE (type)); @@ -2976,8 +3047,8 @@ check_arrival_add_next_nodes (re_match_c if (naccepted > 1) { re_dfastate_t *dest_state; - int next_node = dfa->nexts[cur_node]; - int next_idx = str_idx + naccepted; + Idx next_node = dfa->nexts[cur_node]; + Idx next_idx = str_idx + naccepted; dest_state = mctx->state_log[next_idx]; re_node_set_empty (&union_set); if (dest_state) @@ -2989,8 +3060,8 @@ check_arrival_add_next_nodes (re_match_c return err; } } - result = re_node_set_insert (&union_set, next_node); - if (BE (result < 0, 0)) + ok = re_node_set_insert (&union_set, next_node); + if (BE (! ok, 0)) { re_node_set_free (&union_set); return REG_ESPACE; @@ -3009,8 +3080,8 @@ check_arrival_add_next_nodes (re_match_c if (naccepted || check_node_accept (mctx, dfa->nodes + cur_node, str_idx)) { - result = re_node_set_insert (next_nodes, dfa->nexts[cur_node]); - if (BE (result < 0, 0)) + ok = re_node_set_insert (next_nodes, dfa->nexts[cur_node]); + if (BE (! ok, 0)) { re_node_set_free (&union_set); return REG_ESPACE; @@ -3030,10 +3101,10 @@ check_arrival_add_next_nodes (re_match_c static reg_errcode_t internal_function check_arrival_expand_ecl (re_dfa_t *dfa, re_node_set *cur_nodes, - int ex_subexp, int type) + Idx ex_subexp, int type) { reg_errcode_t err; - int idx, outside_node; + Idx idx, outside_node; re_node_set new_nodes; #ifdef DEBUG assert (cur_nodes->nelem); @@ -3046,10 +3117,10 @@ check_arrival_expand_ecl (re_dfa_t *dfa, for (idx = 0; idx < cur_nodes->nelem; ++idx) { - int cur_node = cur_nodes->elems[idx]; + Idx cur_node = cur_nodes->elems[idx]; re_node_set *eclosure = dfa->eclosures + cur_node; outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type); - if (outside_node == -1) + if (outside_node == REG_MISSING) { /* There are no problematic nodes, just merge them. */ err = re_node_set_merge (&new_nodes, eclosure); @@ -3083,36 +3154,37 @@ check_arrival_expand_ecl (re_dfa_t *dfa, static reg_errcode_t internal_function check_arrival_expand_ecl_sub (re_dfa_t *dfa, re_node_set *dst_nodes, - int target, int ex_subexp, int type) + Idx target, Idx ex_subexp, int type) { - int cur_node; + Idx cur_node; for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);) { - int err; + bool ok; if (dfa->nodes[cur_node].type == type && dfa->nodes[cur_node].opr.idx == ex_subexp) { if (type == OP_CLOSE_SUBEXP) { - err = re_node_set_insert (dst_nodes, cur_node); - if (BE (err == -1, 0)) + ok = re_node_set_insert (dst_nodes, cur_node); + if (BE (! ok, 0)) return REG_ESPACE; } break; } - err = re_node_set_insert (dst_nodes, cur_node); - if (BE (err == -1, 0)) + ok = re_node_set_insert (dst_nodes, cur_node); + if (BE (! ok, 0)) return REG_ESPACE; if (dfa->edests[cur_node].nelem == 0) break; if (dfa->edests[cur_node].nelem == 2) { - err = check_arrival_expand_ecl_sub (dfa, dst_nodes, - dfa->edests[cur_node].elems[1], - ex_subexp, type); - if (BE (err != REG_NOERROR, 0)) - return err; + reg_errcode_t ret = + check_arrival_expand_ecl_sub (dfa, dst_nodes, + dfa->edests[cur_node].elems[1], + ex_subexp, type); + if (BE (ret != REG_NOERROR, 0)) + return ret; } cur_node = dfa->edests[cur_node].elems[0]; } @@ -3127,21 +3199,21 @@ check_arrival_expand_ecl_sub (re_dfa_t * static reg_errcode_t internal_function expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, - int cur_str, int subexp_num, int type) + Idx cur_str, Idx subexp_num, int type) { re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - int cache_idx_start = search_cur_bkref_entry (mctx, cur_str); + Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str); struct re_backref_cache_entry *ent; - if (cache_idx_start == -1) + if (cache_idx_start == REG_MISSING) return REG_NOERROR; restart: ent = mctx->bkref_ents + cache_idx_start; do { - int to_idx, next_node; + Idx to_idx, next_node; /* Is this entry ENT is appropriate? */ if (!re_node_set_contains (cur_nodes, ent->node)) @@ -3179,14 +3251,14 @@ expand_bkref_cache (re_match_context_t * next_node = dfa->nexts[ent->node]; if (mctx->state_log[to_idx]) { - int ret; + bool ok; if (re_node_set_contains (&mctx->state_log[to_idx]->nodes, next_node)) continue; err = re_node_set_init_copy (&union_set, &mctx->state_log[to_idx]->nodes); - ret = re_node_set_insert (&union_set, next_node); - if (BE (err != REG_NOERROR || ret < 0, 0)) + ok = re_node_set_insert (&union_set, next_node); + if (BE (err != REG_NOERROR || ! ok, 0)) { re_node_set_free (&union_set); err = err != REG_NOERROR ? err : REG_ESPACE; @@ -3211,41 +3283,46 @@ expand_bkref_cache (re_match_context_t * } /* Build transition table for the state. - Return 1 if succeeded, otherwise return NULL. */ + Return true if successful. */ -static int +static bool internal_function build_trtable (re_dfa_t *dfa, re_dfastate_t *state) { reg_errcode_t err; - int i, j, ch, need_word_trtable = 0; - unsigned int elem, mask; - int dests_node_malloced = 0, dest_states_malloced = 0; - int ndests; /* Number of the destination states from `state'. */ + Idx i, j; + int ch; + bool need_word_trtable = false; + bitset_word elem, mask; + bool dests_node_malloced = false, dest_states_malloced = false; + Idx ndests; /* Number of the destination states from `state'. */ re_dfastate_t **trtable; re_dfastate_t **dest_states = NULL, **dest_states_word, **dest_states_nl; re_node_set follows, *dests_node; bitset *dests_ch; bitset acceptable; + struct dests_alloc + { + re_node_set dests_node[SBC_MAX]; + bitset dests_ch[SBC_MAX]; + } *dests_alloc; + /* We build DFA states which corresponds to the destination nodes from `state'. `dests_node[i]' represents the nodes which i-th destination state contains, and `dests_ch[i]' represents the characters which i-th destination state accepts. */ -#ifdef _LIBC - if (__libc_use_alloca ((sizeof (re_node_set) + sizeof (bitset)) * SBC_MAX)) - dests_node = (re_node_set *) - alloca ((sizeof (re_node_set) + sizeof (bitset)) * SBC_MAX); + if (__libc_use_alloca (sizeof (struct dests_alloc))) + dests_alloc = (struct dests_alloc *) alloca (sizeof dests_alloc[0]); else -#endif { - dests_node = (re_node_set *) - malloc ((sizeof (re_node_set) + sizeof (bitset)) * SBC_MAX); - if (BE (dests_node == NULL, 0)) - return 0; - dests_node_malloced = 1; + dests_alloc = re_malloc (struct dests_alloc, 1); + if (BE (dests_alloc == NULL, 0)) + return false; + dests_node_malloced = true; } - dests_ch = (bitset *) (dests_node + SBC_MAX); + dests_node = dests_alloc->dests_node; + dests_ch = dests_alloc->dests_ch; /* Initialize transiton table. */ state->word_trtable = state->trtable = NULL; @@ -3253,31 +3330,33 @@ build_trtable (re_dfa_t *dfa, re_dfastat /* At first, group all nodes belonging to `state' into several destinations. */ ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); - if (BE (ndests <= 0, 0)) + if (BE (! REG_VALID_NONZERO_INDEX (ndests), 0)) { if (dests_node_malloced) - free (dests_node); - /* Return 0 in case of an error, 1 otherwise. */ + free (dests_alloc); if (ndests == 0) { - state->trtable = (re_dfastate_t **) - calloc (sizeof (re_dfastate_t *), SBC_MAX); - return 1; + state->trtable = re_calloc (re_dfastate_t *, SBC_MAX); + return true; } - return 0; + return false; } err = re_node_set_alloc (&follows, ndests + 1); if (BE (err != REG_NOERROR, 0)) goto out_free; -#ifdef _LIBC + /* Avoid arithmetic overflow in size calculation. */ + if (BE (((SIZE_MAX - (sizeof (re_node_set) + sizeof (bitset)) * SBC_MAX) + / (3 * sizeof (re_dfastate_t *))) + < ndests, 0)) + goto out_free; + if (__libc_use_alloca ((sizeof (re_node_set) + sizeof (bitset)) * SBC_MAX + ndests * 3 * sizeof (re_dfastate_t *))) dest_states = (re_dfastate_t **) alloca (ndests * 3 * sizeof (re_dfastate_t *)); else -#endif { dest_states = (re_dfastate_t **) malloc (ndests * 3 * sizeof (re_dfastate_t *)); @@ -3290,10 +3369,10 @@ out_free: for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_node); - return 0; + free (dests_alloc); + return false; } - dest_states_malloced = 1; + dest_states_malloced = true; } dest_states_word = dest_states + ndests; dest_states_nl = dest_states_word + ndests; @@ -3302,13 +3381,13 @@ out_free: /* Then build the states for all destinations. */ for (i = 0; i < ndests; ++i) { - int next_node; + Idx next_node; re_node_set_empty (&follows); /* Merge the follows of this destination states. */ for (j = 0; j < dests_node[i].nelem; ++j) { next_node = dfa->nexts[dests_node[i].elems[j]]; - if (next_node != -1) + if (next_node != REG_MISSING) { err = re_node_set_merge (&follows, dfa->eclosures + next_node); if (BE (err != REG_NOERROR, 0)) @@ -3328,7 +3407,7 @@ out_free: goto out_free; if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1) - need_word_trtable = 1; + need_word_trtable = true; dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows, CONTEXT_NEWLINE); @@ -3349,14 +3428,13 @@ out_free: character, or we are in a single-byte character set so we can discern by looking at the character code: allocate a 256-entry transition table. */ - trtable = state->trtable = - (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + trtable = state->trtable = re_calloc (re_dfastate_t *, SBC_MAX); if (BE (trtable == NULL, 0)) goto out_free; /* For all characters ch...: */ - for (i = 0; i < BITSET_UINTS; ++i) - for (ch = i * UINT_BITS, elem = acceptable[i], mask = 1; + for (i = 0; i < BITSET_WORDS; ++i) + for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1; elem; mask <<= 1, elem >>= 1, ++ch) if (BE (elem & 1, 0)) @@ -3380,14 +3458,13 @@ out_free: by looking at the character code: build two 256-entry transition tables, one starting at trtable[0] and one starting at trtable[SBC_MAX]. */ - trtable = state->word_trtable = - (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); + trtable = state->word_trtable = re_calloc (re_dfastate_t *, 2 * SBC_MAX); if (BE (trtable == NULL, 0)) goto out_free; /* For all characters ch...: */ - for (i = 0; i < BITSET_UINTS; ++i) - for (ch = i * UINT_BITS, elem = acceptable[i], mask = 1; + for (i = 0; i < BITSET_WORDS; ++i) + for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1; elem; mask <<= 1, elem >>= 1, ++ch) if (BE (elem & 1, 0)) @@ -3428,9 +3505,9 @@ out_free: re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_node); + free (dests_alloc); - return 1; + return true; } /* Group all nodes belonging to STATE into several destinations. @@ -3438,15 +3515,15 @@ out_free: to DESTS_NODE[i] and set the characters accepted by the destination to DEST_CH[i]. This function return the number of destinations. */ -static int +static Idx internal_function -group_nodes_into_DFAstates (re_dfa_t *dfa, const re_dfastate_t *state, +group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *dests_node, bitset *dests_ch) { reg_errcode_t err; - int result; - int i, j, k; - int ndests; /* Number of the destinations from `state'. */ + bool ok; + Idx i, j, k; + Idx ndests; /* Number of the destinations from `state'. */ bitset accepts; /* Characters a node can accept. */ const re_node_set *cur_nodes = &state->nodes; bitset_empty (accepts); @@ -3474,18 +3551,21 @@ group_nodes_into_DFAstates (re_dfa_t *df else #endif bitset_set_all (accepts); - if (!(dfa->syntax & RE_DOT_NEWLINE)) + if (!(dfa->syntax & REG_DOT_NEWLINE)) bitset_clear (accepts, '\n'); - if (dfa->syntax & RE_DOT_NOT_NULL) + if (dfa->syntax & REG_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } #ifdef RE_ENABLE_I18N else if (type == OP_UTF8_PERIOD) { - memset (accepts, 255, sizeof (unsigned int) * BITSET_UINTS / 2); - if (!(dfa->syntax & RE_DOT_NEWLINE)) + if (SBC_MAX / 2 % BITSET_WORD_BITS == 0) + memset (accepts, -1, sizeof accepts / 2); + else + bitset_merge (accepts, utf8_sb_map); + if (!(dfa->syntax & REG_DOT_NEWLINE)) bitset_clear (accepts, '\n'); - if (dfa->syntax & RE_DOT_NOT_NULL) + if (dfa->syntax & REG_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } #endif @@ -3498,7 +3578,7 @@ group_nodes_into_DFAstates (re_dfa_t *df { if (constraint & NEXT_NEWLINE_CONSTRAINT) { - int accepts_newline = bitset_contain (accepts, NEWLINE_CHAR); + bool accepts_newline = bitset_contain (accepts, NEWLINE_CHAR); bitset_empty (accepts); if (accepts_newline) bitset_set (accepts, NEWLINE_CHAR); @@ -3513,7 +3593,7 @@ group_nodes_into_DFAstates (re_dfa_t *df if (constraint & NEXT_WORD_CONSTRAINT) { - unsigned int any_set = 0; + bitset_word any_set = 0; if (type == CHARACTER && !node->word_char) { bitset_empty (accepts); @@ -3521,18 +3601,18 @@ group_nodes_into_DFAstates (re_dfa_t *df } #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) - for (j = 0; j < BITSET_UINTS; ++j) + for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j])); else #endif - for (j = 0; j < BITSET_UINTS; ++j) + for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= dfa->word_char[j]); if (!any_set) continue; } if (constraint & NEXT_NOTWORD_CONSTRAINT) { - unsigned int any_set = 0; + bitset_word any_set = 0; if (type == CHARACTER && node->word_char) { bitset_empty (accepts); @@ -3540,11 +3620,11 @@ group_nodes_into_DFAstates (re_dfa_t *df } #ifdef RE_ENABLE_I18N if (dfa->mb_cur_max > 1) - for (j = 0; j < BITSET_UINTS; ++j) + for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j])); else #endif - for (j = 0; j < BITSET_UINTS; ++j) + for (j = 0; j < BITSET_WORDS; ++j) any_set |= (accepts[j] &= ~dfa->word_char[j]); if (!any_set) continue; @@ -3558,7 +3638,7 @@ group_nodes_into_DFAstates (re_dfa_t *df bitset intersec; /* Intersection sets, see below. */ bitset remains; /* Flags, see below. */ - int has_intersec, not_subset, not_consumed; + bitset_word has_intersec, not_subset, not_consumed; /* Optimization, skip if this state doesn't accept the character. */ if (type == CHARACTER && !bitset_contain (dests_ch[j], node->opr.c)) @@ -3566,7 +3646,7 @@ group_nodes_into_DFAstates (re_dfa_t *df /* Enumerate the intersection set of this state and `accepts'. */ has_intersec = 0; - for (k = 0; k < BITSET_UINTS; ++k) + for (k = 0; k < BITSET_WORDS; ++k) has_intersec |= intersec[k] = accepts[k] & dests_ch[j][k]; /* And skip if the intersection set is empty. */ if (!has_intersec) @@ -3574,7 +3654,7 @@ group_nodes_into_DFAstates (re_dfa_t *df /* Then check if this state is a subset of `accepts'. */ not_subset = not_consumed = 0; - for (k = 0; k < BITSET_UINTS; ++k) + for (k = 0; k < BITSET_WORDS; ++k) { not_subset |= remains[k] = ~accepts[k] & dests_ch[j][k]; not_consumed |= accepts[k] = accepts[k] & ~dests_ch[j][k]; @@ -3593,8 +3673,8 @@ group_nodes_into_DFAstates (re_dfa_t *df } /* Put the position in the current group. */ - result = re_node_set_insert (&dests_node[j], cur_nodes->elems[i]); - if (BE (result < 0, 0)) + ok = re_node_set_insert (&dests_node[j], cur_nodes->elems[i]); + if (BE (! ok, 0)) goto error_return; /* If all characters are consumed, go to next node. */ @@ -3616,7 +3696,7 @@ group_nodes_into_DFAstates (re_dfa_t *df error_return: for (j = 0; j < ndests; ++j) re_node_set_free (dests_node + j); - return -1; + return REG_MISSING; } #ifdef RE_ENABLE_I18N @@ -3630,12 +3710,12 @@ group_nodes_into_DFAstates (re_dfa_t *df static int internal_function -check_node_accept_bytes (re_dfa_t *dfa, int node_idx, - const re_string_t *input, int str_idx) +check_node_accept_bytes (re_dfa_t *dfa, Idx node_idx, + const re_string_t *input, Idx str_idx) { const re_token_t *node = dfa->nodes + node_idx; int char_len, elem_len; - int i; + Idx i; if (BE (node->type == OP_UTF8_PERIOD, 0)) { @@ -3696,9 +3776,9 @@ check_node_accept_bytes (re_dfa_t *dfa, /* FIXME: I don't think this if is needed, as both '\n' and '\0' are char_len == 1. */ /* '.' accepts any one character except the following two cases. */ - if ((!(dfa->syntax & RE_DOT_NEWLINE) && + if ((!(dfa->syntax & REG_DOT_NEWLINE) && re_string_byte_at (input, str_idx) == '\n') || - ((dfa->syntax & RE_DOT_NOT_NULL) && + ((dfa->syntax & REG_DOT_NOT_NULL) && re_string_byte_at (input, str_idx) == '\0')) return 0; return char_len; @@ -3714,7 +3794,7 @@ check_node_accept_bytes (re_dfa_t *dfa, # ifdef _LIBC const unsigned char *pin = ((const unsigned char *) re_string_get_buffer (input) + str_idx); - int j; + Idx j; uint32_t nrules; # endif /* _LIBC */ int match_len = 0; @@ -3813,7 +3893,7 @@ check_node_accept_bytes (re_dfa_t *dfa, size_t weight_len = weights[idx]; if (weight_len == weights[equiv_class_idx]) { - int cnt = 0; + Idx cnt = 0; while (cnt <= weight_len && (weights[equiv_class_idx + 1 + cnt] == weights[idx + 1 + cnt])) @@ -3865,9 +3945,7 @@ check_node_accept_bytes (re_dfa_t *dfa, # ifdef _LIBC static unsigned int -find_collation_sequence_value (mbs, mbs_len) - const unsigned char *mbs; - size_t mbs_len; +find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len) { uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules == 0) @@ -3891,7 +3969,8 @@ find_collation_sequence_value (mbs, mbs_ for (idx = 0; idx < extrasize;) { - int mbs_cnt, found = 0; + int mbs_cnt; + bool found = false; int32_t elem_mbs_len; /* Skip the name of collating element name. */ idx = idx + extra[idx] + 1; @@ -3903,7 +3982,7 @@ find_collation_sequence_value (mbs, mbs_ break; if (mbs_cnt == elem_mbs_len) /* Found the entry. */ - found = 1; + found = true; } /* Skip the byte sequence of the collating element. */ idx += elem_mbs_len; @@ -3928,10 +4007,10 @@ find_collation_sequence_value (mbs, mbs_ /* Check whether the node accepts the byte which is IDX-th byte of the INPUT. */ -static int +static bool internal_function check_node_accept (const re_match_context_t *mctx, const re_token_t *node, - int idx) + Idx idx) { unsigned char ch; ch = re_string_byte_at (&mctx->input, idx); @@ -3939,28 +4018,28 @@ check_node_accept (const re_match_contex { case CHARACTER: if (node->opr.c != ch) - return 0; + return false; break; case SIMPLE_BRACKET: if (!bitset_contain (node->opr.sbcset, ch)) - return 0; + return false; break; #ifdef RE_ENABLE_I18N case OP_UTF8_PERIOD: if (ch >= 0x80) - return 0; + return false; /* FALLTHROUGH */ #endif case OP_PERIOD: - if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE)) - || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL))) - return 0; + if ((ch == '\n' && !(mctx->dfa->syntax & REG_DOT_NEWLINE)) + || (ch == '\0' && (mctx->dfa->syntax & REG_DOT_NOT_NULL))) + return false; break; default: - return 0; + return false; } if (node->constraint) @@ -3970,10 +4049,10 @@ check_node_accept (const re_match_contex unsigned int context = re_string_context_at (&mctx->input, idx, mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) - return 0; + return false; } - return 1; + return true; } /* Extend the buffers, if the buffers have run out. */ @@ -3996,8 +4075,8 @@ extend_buffers (re_match_context_t *mctx /* XXX We have no indication of the size of this buffer. If this allocation fail we have no indication that the state_log array does not have the right size. */ - re_dfastate_t **new_array = re_realloc (mctx->state_log, re_dfastate_t *, - pstr->bufs_len + 1); + re_dfastate_t **new_array = re_xrealloc (mctx->state_log, re_dfastate_t *, + pstr->bufs_len + 1); if (BE (new_array == NULL, 0)) return REG_ESPACE; mctx->state_log = new_array; @@ -4039,14 +4118,14 @@ extend_buffers (re_match_context_t *mctx static reg_errcode_t internal_function -match_ctx_init (re_match_context_t *mctx, int eflags, int n) +match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) { mctx->eflags = eflags; - mctx->match_last = -1; + mctx->match_last = REG_MISSING; if (n > 0) { - mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n); - mctx->sub_tops = re_malloc (re_sub_match_top_t *, n); + mctx->bkref_ents = re_xmalloc (struct re_backref_cache_entry, n); + mctx->sub_tops = re_xmalloc (re_sub_match_top_t *, n); if (BE (mctx->bkref_ents == NULL || mctx->sub_tops == NULL, 0)) return REG_ESPACE; } @@ -4069,10 +4148,10 @@ static void internal_function match_ctx_clean (re_match_context_t *mctx) { - int st_idx; + Idx st_idx; for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx) { - int sl_idx; + Idx sl_idx; re_sub_match_top_t *top = mctx->sub_tops[st_idx]; for (sl_idx = 0; sl_idx < top->nlasts; ++sl_idx) { @@ -4112,14 +4191,14 @@ match_ctx_free (re_match_context_t *mctx static reg_errcode_t internal_function -match_ctx_add_entry (re_match_context_t *mctx, int node, int str_idx, - int from, int to) +match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, + Idx from, Idx to) { if (mctx->nbkref_ents >= mctx->abkref_ents) { struct re_backref_cache_entry* new_entry; - new_entry = re_realloc (mctx->bkref_ents, struct re_backref_cache_entry, - mctx->abkref_ents * 2); + new_entry = re_x2realloc (mctx->bkref_ents, struct re_backref_cache_entry, + &mctx->abkref_ents); if (BE (new_entry == NULL, 0)) { re_free (mctx->bkref_ents); @@ -4127,8 +4206,8 @@ match_ctx_add_entry (re_match_context_t } mctx->bkref_ents = new_entry; memset (mctx->bkref_ents + mctx->nbkref_ents, '\0', - sizeof (struct re_backref_cache_entry) * mctx->abkref_ents); - mctx->abkref_ents *= 2; + (sizeof (struct re_backref_cache_entry) + * (mctx->abkref_ents - mctx->nbkref_ents))); } if (mctx->nbkref_ents > 0 && mctx->bkref_ents[mctx->nbkref_ents - 1].str_idx == str_idx) @@ -4148,7 +4227,7 @@ match_ctx_add_entry (re_match_context_t A backreference does not epsilon-transition unless it is empty, so set to all zeros if FROM != TO. */ mctx->bkref_ents[mctx->nbkref_ents].eps_reachable_subexps_map - = (from == to ? ~0 : 0); + = (from == to ? -1 : 0); mctx->bkref_ents[mctx->nbkref_ents++].more = 0; if (mctx->max_mb_elem_len < to - from) @@ -4156,14 +4235,14 @@ match_ctx_add_entry (re_match_context_t return REG_NOERROR; } -/* Search for the first entry which has the same str_idx, or -1 if none is +/* Return the first entry with the same str_idx, or REG_MISSING if none is found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */ -static int +static Idx internal_function -search_cur_bkref_entry (re_match_context_t *mctx, int str_idx) +search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) { - int left, right, mid, last; + Idx left, right, mid, last; last = right = mctx->nbkref_ents; for (left = 0; left < right;) { @@ -4176,7 +4255,7 @@ search_cur_bkref_entry (re_match_context if (left < last && mctx->bkref_ents[left].str_idx == str_idx) return left; else - return -1; + return REG_MISSING; } /* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches @@ -4184,7 +4263,7 @@ search_cur_bkref_entry (re_match_context static reg_errcode_t internal_function -match_ctx_add_subtop (re_match_context_t *mctx, int node, int str_idx) +match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) { #ifdef DEBUG assert (mctx->sub_tops != NULL); @@ -4192,16 +4271,16 @@ match_ctx_add_subtop (re_match_context_t #endif if (BE (mctx->nsub_tops == mctx->asub_tops, 0)) { - int new_asub_tops = mctx->asub_tops * 2; - re_sub_match_top_t **new_array = re_realloc (mctx->sub_tops, - re_sub_match_top_t *, - new_asub_tops); + Idx new_asub_tops = mctx->asub_tops; + re_sub_match_top_t **new_array = re_x2realloc (mctx->sub_tops, + re_sub_match_top_t *, + &new_asub_tops); if (BE (new_array == NULL, 0)) return REG_ESPACE; mctx->sub_tops = new_array; mctx->asub_tops = new_asub_tops; } - mctx->sub_tops[mctx->nsub_tops] = calloc (1, sizeof (re_sub_match_top_t)); + mctx->sub_tops[mctx->nsub_tops] = re_calloc (re_sub_match_top_t, 1); if (BE (mctx->sub_tops[mctx->nsub_tops] == NULL, 0)) return REG_ESPACE; mctx->sub_tops[mctx->nsub_tops]->node = node; @@ -4214,21 +4293,21 @@ match_ctx_add_subtop (re_match_context_t static re_sub_match_last_t * internal_function -match_ctx_add_sublast (re_sub_match_top_t *subtop, int node, int str_idx) +match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx) { re_sub_match_last_t *new_entry; if (BE (subtop->nlasts == subtop->alasts, 0)) { - int new_alasts = 2 * subtop->alasts + 1; - re_sub_match_last_t **new_array = re_realloc (subtop->lasts, - re_sub_match_last_t *, - new_alasts); + Idx new_alasts = subtop->alasts; + re_sub_match_last_t **new_array = re_x2realloc (subtop->lasts, + re_sub_match_last_t *, + &new_alasts); if (BE (new_array == NULL, 0)) return NULL; subtop->lasts = new_array; subtop->alasts = new_alasts; } - new_entry = calloc (1, sizeof (re_sub_match_last_t)); + new_entry = re_calloc (re_sub_match_last_t, 1); if (BE (new_entry != NULL, 1)) { subtop->lasts[subtop->nlasts] = new_entry; @@ -4244,7 +4323,7 @@ internal_function sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, - int last_node, int last_str_idx) + Idx last_node, Idx last_str_idx) { sctx->sifted_states = sifted_sts; sctx->limited_states = limited_sts; Index: m4/regex.m4 =================================================================== RCS file: /fetish/cu/m4/regex.m4,v retrieving revision 1.39 diff -p -u -r1.39 regex.m4 --- m4/regex.m4 25 Jul 2005 19:29:34 -0000 1.39 +++ m4/regex.m4 9 Sep 2005 20:58:17 -0000 @@ -1,4 +1,4 @@ -#serial 24 +#serial 29 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free # Software Foundation, Inc. @@ -10,121 +10,125 @@ dnl Initially derived from code in GNU grep. dnl Mostly written by Jim Meyering. +AC_PREREQ([2.50]) + AC_DEFUN([gl_REGEX], [ - gl_INCLUDED_REGEX([lib/regex.c]) -]) - -dnl Usage: gl_INCLUDED_REGEX([lib/regex.c]) -dnl -AC_DEFUN([gl_INCLUDED_REGEX], - [ - AC_LIBSOURCES( - [regcomp.c, regex.c, regex.h, - regex_internal.c, regex_internal.h, regexec.c]) - - dnl Even packages that don't use regex.c can use this macro. - dnl Of course, for them it doesn't do anything. - - # Assume we'll default to using the included regex.c. - ac_use_included_regex=yes - - # However, if the system regex support is good enough that it passes the - # the following run test, then default to *not* using the included regex.c. + AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t + AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, + [Define if you want regoff_t to be at least as wide POSIX requires.]) + + AC_LIBSOURCES( + [regcomp.c, regex.c, regex.h, + regex_internal.c, regex_internal.h, regexec.c]) + + AC_ARG_WITH([included-regex], + [AC_HELP_STRING([--without-included-regex], + [don't compile regex; this is the default on + systems with recent-enough versions of the GNU C + Library (use with caution on other systems)])]) + + case $with_included_regex in + yes|no) ac_use_included_regex=$with_included_regex + ;; + '') + # If the system regex support is good enough that it passes the the + # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. The first failing regular expression is from `Spencer ere # test #75' in grep-2.3. AC_CACHE_CHECK([for working re_compile_pattern], - [gl_cv_func_working_re_compile_pattern], + [gl_cv_func_re_compile_pattern_broken], [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT - #include ], - [[static struct re_pattern_buffer regex; - const char *s; - struct re_registers regs; - re_set_syntax (RE_SYNTAX_POSIX_EGREP); - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("a[:@:>@:]b\n", 9, ®ex); - /* This should fail with _Invalid character class name_ error. */ - if (!s) - exit (1); - - /* This should succeed, but does not for e.g. glibc-2.1.3. */ - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("{1", 2, ®ex); - - if (s) - exit (1); - - /* The following example is derived from a problem report - against gawk from Jorge Stolfi . */ - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("[an\371]*n", 7, ®ex); - if (s) - exit (1); - - /* This should match, but does not for e.g. glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - exit (1); - - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - exit (1); - - /* The version of regex.c in e.g. GNU libc-2.2.93 did not - work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - exit (1); - - /* The version of regex.c in older versions of gnulib - * ignored RE_ICASE. Detect that problem too. */ - memset (®ex, 0, sizeof (regex)); - re_set_syntax(RE_SYNTAX_EMACS|RE_ICASE); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - exit (1); - - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - exit (1); - - /* REG_STARTEND was added to glibc on 2004-01-15. - Reject older versions. */ - if (! REG_STARTEND) - exit (1); - - exit (0);]])], - [gl_cv_func_working_re_compile_pattern=yes], - [gl_cv_func_working_re_compile_pattern=no], - dnl When crosscompiling, assume it is broken. - [gl_cv_func_working_re_compile_pattern=no])]) - if test $gl_cv_func_working_re_compile_pattern = yes; then - ac_use_included_regex=no - fi - - test -n "$1" || AC_MSG_ERROR([missing argument]) - m4_syscmd([test -f '$1']) - ifelse(m4_sysval, 0, - [ - AC_ARG_WITH([included-regex], - [ --without-included-regex don't compile regex; this is the default on - systems with recent-enough versions of the GNU C - Library (use with caution on other systems)], - [gl_with_regex=$withval], - [gl_with_regex=$ac_use_included_regex]) - if test "X$gl_with_regex" = Xyes; then - AC_LIBOBJ([regex]) - gl_PREREQ_REGEX - fi - ], - ) - ] -) + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT + #include ], + [[static struct re_pattern_buffer regex; + const char *s; + struct re_registers regs; + /* Use the POSIX-compliant spelling with leading REG_, + rather than the traditional GNU spelling with leading RE_, + so that we reject older libc implementations. */ + re_set_syntax (REG_SYNTAX_POSIX_EGREP); + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("a[:@:>@:]b\n", 9, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + exit (1); + + /* This should succeed, but does not for e.g. glibc-2.1.3. */ + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("{1", 2, ®ex); + + if (s) + exit (1); + + /* The following example is derived from a problem report + against gawk from Jorge Stolfi . */ + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("[an\371]*n", 7, ®ex); + if (s) + exit (1); + + /* This should match, but does not for e.g. glibc-2.2.1. */ + if (re_match (®ex, "an", 2, 0, ®s) != 2) + exit (1); + + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + exit (1); + + /* The version of regex.c in e.g. GNU libc-2.2.93 did not + work with a negative RANGE argument. */ + if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + exit (1); + + /* The version of regex.c in older versions of gnulib + ignored REG_IGNORE_CASE (which was then called RE_ICASE). + Detect that problem too. */ + memset (®ex, 0, sizeof (regex)); + re_set_syntax (REG_SYNTAX_EMACS | REG_IGNORE_CASE); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + exit (1); + + if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + exit (1); + + /* REG_STARTEND was added to glibc on 2004-01-15. + Reject older versions. */ + if (! REG_STARTEND) + exit (1); + + /* Reject hosts whose regoff_t values are too narrow. + These include glibc 2.3.5 on hosts with 64-bit off_t + and 32-bit int, and Solaris 10 on hosts with 32-bit int + and _FILE_OFFSET_BITS=64. */ + if (sizeof (regoff_t) < sizeof (off_t)) + exit (1); + + exit (0);]])], + [gl_cv_func_re_compile_pattern_broken=no], + [gl_cv_func_re_compile_pattern_broken=yes], + dnl When crosscompiling, assume it is broken. + [gl_cv_func_re_compile_pattern_broken=yes])]) + ac_use_included_regex=$gl_cv_func_re_compile_pattern_broken + ;; + *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) + ;; + esac + + if test $ac_use_included_regex = yes; then + AC_LIBOBJ([regex]) + gl_PREREQ_REGEX + fi +]) # Prerequisites of lib/regex.c and lib/regex_internal.c. AC_DEFUN([gl_PREREQ_REGEX], [ + AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_C_RESTRICT]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h]) From MAILER-DAEMON Sat Sep 10 03:32:18 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EDzqS-0008JE-P4 for mharc-bug-coreutils@gnu.org; Sat, 10 Sep 2005 03:32:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EDzqN-0008Gu-Oq for bug-coreutils@gnu.org; Sat, 10 Sep 2005 03:32:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EDzqJ-0008FV-Vl for bug-coreutils@gnu.org; Sat, 10 Sep 2005 03:32:09 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDzqJ-0008FL-Sz for bug-coreutils@gnu.org; Sat, 10 Sep 2005 03:32:07 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EDzqK-0001DS-W8 for bug-coreutils@gnu.org; Sat, 10 Sep 2005 03:32:09 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id E3916306; Sat, 10 Sep 2005 09:31:53 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26663; Sat, 10 Sep 05 09:31:48 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id A3828306; Sat, 10 Sep 2005 09:31:47 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 56E9344004; Sat, 10 Sep 2005 09:31:47 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18477-01-2; Sat, 10 Sep 2005 09:31:46 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id AEED344002; Sat, 10 Sep 2005 09:31:46 +0200 (CEST) Received: (nullmailer pid 18958 invoked by uid 30270); Sat, 10 Sep 2005 07:31:46 -0000 From: "Alfred M\. Szmidt" To: ericblake@comcast.net (Eric Blake) In-reply-to: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> (ericblake@comcast.net) References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> Date: Sat, 10 Sep 2005 09:31:46 +0200 Message-Id: <1126337506.282561.18957.nullmailer@Update.UU.SE> Cc: AbhaySingh.Rawat@tcs.tcpn.com, bug-coreutils@gnu.org Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2005 07:32:12 -0000 Unfortunately, you've stumbled across one of the weakness of open source. And unfortunatly you are crediting GNU coreutils to a movement that doesn't care about freedom. Design documents have nothing to do with free software, or open source for that matter. For GNU coreutils there is little to talk about `design' documents, since such a document would be bigger than the actual source code (which I might add is quite easy to follow!) for GNU Coreutils. In other words, the source code is your design document. From MAILER-DAEMON Sat Sep 10 10:42:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EE6Yj-0005yG-HC for mharc-bug-coreutils@gnu.org; Sat, 10 Sep 2005 10:42:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EE6Yb-0005ua-50 for bug-coreutils@gnu.org; Sat, 10 Sep 2005 10:42:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EE6YQ-0005om-3P for bug-coreutils@gnu.org; Sat, 10 Sep 2005 10:42:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EE6YM-0005hh-Lh for bug-coreutils@gnu.org; Sat, 10 Sep 2005 10:42:02 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EE6QT-00038O-Pv for bug-coreutils@gnu.org; Sat, 10 Sep 2005 10:33:54 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 05C3E194C; Sat, 10 Sep 2005 16:33:40 +0200 (CEST) From: Jim Meyering To: Tristan Miller In-Reply-To: <200509100007.55821.psychonaut@nothingisreal.com> (Tristan Miller's message of "Sat, 10 Sep 2005 00:07:54 +0200") References: <200509100007.55821.psychonaut@nothingisreal.com> Date: Sat, 10 Sep 2005 16:33:40 +0200 Message-ID: <8764t9t2kb.fsf@rho.meyering.net> Lines: 162 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: csplit corrupts files with long lines X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2005 14:42:20 -0000 Tristan Miller wrote: > I'm reporting a bug with csplit coreutils 5.2.1, compiled from sources on a > SuSE 9.3 system. It seems this bug was previously reported over a year > ago (see > ) > but it was never squashed. > > In short, csplit produces corrupt output when the input file contains very > long lines. An example file is at > , an XML file > containing three articles from Wikipedia. The second article was > vandalized by a spammer who inserted a ridiculously long line (42280 > characters) full of links. > > If I try to split this file with > > $ csplit wikipedia.xml '//' '{*}' > > then the file with the second article, xx02, is garbled at the beginning of > the long line. See . Thanks for reporting that! Here's the fix I've just checked in: [there's still a minor memory leak, but we'll deal with that separately] 2005-09-10 Jim Meyering csplit could produce corrupt output, given input lines longer than 8KB * src/csplit.c (load_buffer): Don't read from free'd memory when handling lines longer than the initial buffer length. (save_to_hold_area): Don't leak the previous hold_area buffer. Reported by Tristan Miller and Luke Kendall. * NEWS: Mention this. * tests/misc/csplit: New test for this. * src/csplit.c (load_buffer): Avoid integer overflow in buffer size calculations for very long lines. Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.307 retrieving revision 1.308 diff -u -p -u -r1.307 -r1.308 --- NEWS 10 Sep 2005 00:08:28 -0000 1.307 +++ NEWS 10 Sep 2005 14:07:59 -0000 1.308 @@ -136,6 +136,8 @@ GNU coreutils NEWS permissions like =xX and =u, and did not properly diagnose some invalid strings like g+gr, ug,+x, and +1. These bugs have been fixed. + csplit could produce corrupt output, given input lines longer than 8KB + dd now computes statistics using a realtime clock (if available) rather than the time-of-day clock, to avoid glitches if the time-of-day is changed while dd is running. Also, it avoids Index: src/csplit.c =================================================================== RCS file: /fetish/cu/src/csplit.c,v retrieving revision 1.144 retrieving revision 1.145 diff -u -p -u -r1.144 -r1.145 --- src/csplit.c 9 Sep 2005 21:08:19 -0000 1.144 +++ src/csplit.c 10 Sep 2005 13:56:45 -0000 1.145 @@ -251,16 +251,12 @@ interrupt_handler (int sig) } /* Keep track of NUM bytes of a partial line in buffer START. - These bytes will be retrieved later when another large buffer is read. - It is not necessary to create a new buffer for these bytes; instead, - we keep a pointer to the existing buffer. This buffer *is* on the - free list, and when the next buffer is obtained from this list - (even if it is this one), these bytes will be placed at the - start of the new buffer. */ + These bytes will be retrieved later when another large buffer is read. */ static void save_to_hold_area (char *start, size_t num) { + free (hold_area); hold_area = start; hold_count = num; } @@ -386,7 +382,7 @@ record_line_starts (struct buffer_record lines++; } else - save_to_hold_area (line_start, bytes_left); + save_to_hold_area (xmemdup (line_start, bytes_left), bytes_left); } b->num_lines = lines; @@ -442,6 +438,7 @@ static void free_buffer (struct buffer_record *buf) { free (buf->buffer); + buf->buffer = NULL; } /* Append buffer BUF to the linked list of buffers that contain @@ -495,7 +492,7 @@ load_buffer (void) if (bytes_wanted < hold_count) bytes_wanted = hold_count; - do + while (1) { b = get_new_buffer (bytes_wanted); bytes_avail = b->bytes_alloc; /* Size of buffer returned. */ @@ -504,8 +501,7 @@ load_buffer (void) /* First check the `holding' area for a partial line. */ if (hold_count) { - if (p != hold_area) - memcpy (p, hold_area, hold_count); + memcpy (p, hold_area, hold_count); p += hold_count; b->bytes_used += hold_count; bytes_avail -= hold_count; @@ -515,11 +511,18 @@ load_buffer (void) b->bytes_used += read_input (p, bytes_avail); lines_found = record_line_starts (b); - bytes_wanted = b->bytes_alloc * 2; if (!lines_found) free_buffer (b); + + if (lines_found || have_read_eof) + break; + + if (xalloc_oversized (2, b->bytes_alloc)) + xalloc_die (); + bytes_wanted = 2 * b->bytes_alloc; + free_buffer (b); + free (b); } - while (!lines_found && !have_read_eof); if (lines_found) save_buffer (b); Index: tests/misc/csplit =================================================================== RCS file: /fetish/cu/tests/misc/csplit,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -u -r1.6 -r1.7 --- tests/misc/csplit 23 Jun 2004 15:07:04 -0000 1.6 +++ tests/misc/csplit 10 Sep 2005 14:06:29 -0000 1.7 @@ -86,4 +86,13 @@ EOF cmp err experr || fail=1 test $fail = 1 && diff err experr 2> /dev/null +# Ensure that lines longer than the initial buffer length don't cause +# trouble (e.g. reading from freed memory, resulting in corrupt output). +# This test failed at least in coreutils-5.2.1 and 5.3.0, and was fixed +# in 5.3.1. +rm -f in out exp err experr xx?? +printf 'x%8199s\nx\n%8199s\nx\n' x x > in +csplit in '/x/' '{*}' > /dev/null || fail=1 +cat xx?? | cmp - in || fail=1 + (exit $fail); exit $fail From MAILER-DAEMON Sat Sep 10 16:01:48 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EEBXo-0006qE-4w for mharc-bug-coreutils@gnu.org; Sat, 10 Sep 2005 16:01:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEBXh-0006mp-25 for bug-coreutils@gnu.org; Sat, 10 Sep 2005 16:01:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEBXc-0006jv-3e for bug-coreutils@gnu.org; Sat, 10 Sep 2005 16:01:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEBXc-0006j9-07 for bug-coreutils@gnu.org; Sat, 10 Sep 2005 16:01:36 -0400 Received: from [128.148.106.154] (helo=pyxis.services.brown.edu) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EEBWX-0005Td-Eg; Sat, 10 Sep 2005 16:00:29 -0400 Received: from techhouse.brown.edu (techhouse.brown.edu [138.16.60.2]) by pyxis.services.brown.edu (Switch-3.1.7/Switch-3.1.7/) with ESMTP id j8AK0AcA024492; Sat, 10 Sep 2005 16:00:10 -0400 (EDT) Received: by techhouse.brown.edu (Postfix, from userid 580) id 3CF9EB90DB; Sat, 10 Sep 2005 16:00:10 -0400 (EDT) Date: Sat, 10 Sep 2005 16:00:10 -0400 To: "Alfred M. Szmidt" , bug-coreutils@gnu.org Message-ID: <20050910200009.GB26800@techhouse.org> References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> <1126337506.282561.18957.nullmailer@Update.UU.SE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1126337506.282561.18957.nullmailer@Update.UU.SE> User-Agent: Mutt/1.5.9i From: dfeuer@techhouse.brown.edu (David Feuer) X-Brown-Proofpoint: Not Infected X-Proofpoint-Spam-Reason: safe Cc: Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2005 20:01:44 -0000 On Sat, Sep 10, 2005 at 09:31:46AM +0200, Alfred M. Szmidt wrote: > Design documents have nothing to do with free software, or open source > for that matter. For GNU coreutils there is little to talk about > `design' documents, since such a document would be bigger than the > actual source code (which I might add is quite easy to follow!) for > GNU Coreutils. In other words, the source code is your design > document. Unfortunately, the source code does not always have the internal documentation it should, and can be quite hard to follow. An excellent example of this is sort.c. The problem is not confined to coreutils. GNU libc, for instance, does not provide any documentation whatsoever on how it handles locales internally. Locales are compiled from human-readable standard format to a completely undocumented internal format. For some spectacularly unreadable code, look at the source for strcoll and strxfrm. David Feuer From MAILER-DAEMON Sun Sep 11 04:09:25 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EEMtd-0001yy-Cv for mharc-bug-coreutils@gnu.org; Sun, 11 Sep 2005 04:09:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEMtT-0001qf-3v for bug-coreutils@gnu.org; Sun, 11 Sep 2005 04:08:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEMrx-0001EA-Uy for bug-coreutils@gnu.org; Sun, 11 Sep 2005 04:07:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEMqC-0000Ls-PY for bug-coreutils@gnu.org; Sun, 11 Sep 2005 04:05:33 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EEMqW-0001lM-9f for bug-coreutils@gnu.org; Sun, 11 Sep 2005 04:05:52 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id C85812A2; Sun, 11 Sep 2005 10:05:29 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26631; Sun, 11 Sep 05 10:05:20 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id C5AB42A2; Sun, 11 Sep 2005 10:05:19 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 4FDA044003; Sun, 11 Sep 2005 10:05:19 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02062-01-11; Sun, 11 Sep 2005 10:05:17 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id C339744002; Sun, 11 Sep 2005 10:05:17 +0200 (CEST) Received: (nullmailer pid 24246 invoked by uid 30270); Sun, 11 Sep 2005 08:05:17 -0000 From: "Alfred M\. Szmidt" To: dfeuer@techhouse.brown.edu (David Feuer) In-reply-to: <20050910200009.GB26800@techhouse.org> (dfeuer@techhouse.brown.edu) References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> <1126337506.282561.18957.nullmailer@Update.UU.SE> <20050910200009.GB26800@techhouse.org> Date: Sun, 11 Sep 2005 10:05:17 +0200 Message-Id: <1126425917.496044.24245.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 08:09:02 -0000 Unfortunately, the source code does not always have the internal documentation it should, and can be quite hard to follow. An excellent example of this is sort.c. Bad example, sort.c is trivial to follow and understand. The problem is not confined to coreutils. GNU libc, for instance, does not provide any documentation whatsoever on how it handles locales internally. Locales are compiled from human-readable standard format to a completely undocumented internal format. For some spectacularly unreadable code, look at the source for strcoll and strxfrm. I just did, quite easy to follow (strcoll just calls strcoll_l, same deal for strxfrm). If you meant the strcoll_l/strxfrm_l functions, you might have a point, but then, string handling of any kind in C is hairy. Understanding what str{coll,xfrm} do will help you understand what the code does, and how it does it. As for how locales are compiled (not my turf in libc land), no idea, but I doubt that format is "completely undocumented". I think you are just not proficient in C to understand a bit more complex C code, and wish to have a crutch called `internal documentation'. Cheers. From MAILER-DAEMON Sun Sep 11 05:15:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EENvT-0005w4-1P for mharc-bug-coreutils@gnu.org; Sun, 11 Sep 2005 05:15:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EENuA-0005pj-Ar for bug-coreutils@gnu.org; Sun, 11 Sep 2005 05:13:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EENty-0005oX-18 for bug-coreutils@gnu.org; Sun, 11 Sep 2005 05:13:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EENrW-0005F3-3p for bug-coreutils@gnu.org; Sun, 11 Sep 2005 05:10:59 -0400 Received: from [128.148.106.155] (helo=scorpio.services.brown.edu) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EENPN-0004A2-9I; Sun, 11 Sep 2005 04:41:53 -0400 Received: from techhouse.brown.edu (techhouse.brown.edu [138.16.60.2]) by scorpio.services.brown.edu (Switch-3.1.7/Switch-3.1.7/) with ESMTP id j8B8fTID026674; Sun, 11 Sep 2005 04:41:29 -0400 (EDT) Received: by techhouse.brown.edu (Postfix, from userid 580) id 020D9B90DB; Sun, 11 Sep 2005 04:41:28 -0400 (EDT) Date: Sun, 11 Sep 2005 04:41:28 -0400 To: "Alfred M. Szmidt" , bug-coreutils@gnu.org Message-ID: <20050911084128.GA4946@techhouse.org> References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> <1126337506.282561.18957.nullmailer@Update.UU.SE> <20050910200009.GB26800@techhouse.org> <1126425917.496044.24245.nullmailer@Update.UU.SE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1126425917.496044.24245.nullmailer@Update.UU.SE> User-Agent: Mutt/1.5.9i From: dfeuer@techhouse.brown.edu (David Feuer) X-Brown-Proofpoint: Not Infected X-Proofpoint-Spam-Reason: safe Cc: Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 09:14:55 -0000 On Sun, Sep 11, 2005 at 10:05:17AM +0200, Alfred M. Szmidt wrote: > Unfortunately, the source code does not always have the internal > documentation it should, and can be quite hard to follow. An > excellent example of this is sort.c. > > Bad example, sort.c is trivial to follow and understand. Much of it is, some of it is not. The whole darn thing being in one file sure doesn't help matters. > I just did, quite easy to follow (strcoll just calls strcoll_l, same > deal for strxfrm). If you meant the strcoll_l/strxfrm_l functions, which I obviously did, > you might have a point, but then, string handling of any kind in C is > hairy. Understanding what str{coll,xfrm} do will help you understand > what the code does, and how it does it. While strcoll is fully specified by the standards, strxfrm is only pertially specified. The details are implementation-dependent. As far as I can tell, the details of what GNU libc strxfrm does are not documented. > As for how locales are > compiled (not my turf in libc land), no idea, but I doubt that format > is "completely undocumented". Very nice that you doubt it. I did my own personal best to search the source for documentation on the file format without success. I asked for help on the GNU libc mailing list without success. If you tell me where to find the documentation, I will be very thankful. Good luck. > I think you are just not proficient in C to understand a bit more > complex C code, and wish to have a crutch called `internal > documentation'. It is surely true that I am not the best programmer in the world. But when faced by things like glibc-2.3.5/locale/coll-lookup.c I suspect even a fancy New York keyboard jockey would wonder just what it was all about. David From MAILER-DAEMON Sun Sep 11 09:31:04 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EERvC-00076F-M3 for mharc-bug-coreutils@gnu.org; Sun, 11 Sep 2005 09:31:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EERv8-00075I-Hj for bug-coreutils@gnu.org; Sun, 11 Sep 2005 09:30:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EERv4-00074h-Nz for bug-coreutils@gnu.org; Sun, 11 Sep 2005 09:30:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EERv1-0006xH-Io for bug-coreutils@gnu.org; Sun, 11 Sep 2005 09:30:52 -0400 Received: from [195.135.220.2] (helo=mx1.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EERgY-0003tD-7u; Sun, 11 Sep 2005 09:15:54 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 45131DAFA; Sun, 11 Sep 2005 15:15:27 +0200 (CEST) From: Andreas Schwab To: dfeuer@techhouse.brown.edu (David Feuer) References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> <1126337506.282561.18957.nullmailer@Update.UU.SE> <20050910200009.GB26800@techhouse.org> <1126425917.496044.24245.nullmailer@Update.UU.SE> <20050911084128.GA4946@techhouse.org> X-Yow: Yow! I want to mail a bronzed artichoke to Nicaragua! Date: Sun, 11 Sep 2005 15:15:26 +0200 In-Reply-To: <20050911084128.GA4946@techhouse.org> (David Feuer's message of "Sun, 11 Sep 2005 04:41:28 -0400") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 13:31:00 -0000 dfeuer@techhouse.brown.edu (David Feuer) writes: > It is surely true that I am not the best programmer in the world. But > when faced by things like glibc-2.3.5/locale/coll-lookup.c I suspect > even a fancy New York keyboard jockey would wonder just what it was all > about. It's actually rather easy to grok, just some multi-level table lookup, with each level being indexed by different bit fields from the key as described by the first five entries in the table. And the variable are named with quite descriptive names. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From MAILER-DAEMON Sun Sep 11 10:35:46 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EESvm-0005Oe-Oa for mharc-bug-coreutils@gnu.org; Sun, 11 Sep 2005 10:35:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EESvd-0005KD-1c for bug-coreutils@gnu.org; Sun, 11 Sep 2005 10:35:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EESvY-0005Il-T0 for bug-coreutils@gnu.org; Sun, 11 Sep 2005 10:35:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EESvY-000583-MW for bug-coreutils@gnu.org; Sun, 11 Sep 2005 10:35:28 -0400 Received: from [128.148.106.154] (helo=pyxis.services.brown.edu) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EESZf-0007Q9-SF for bug-coreutils@gnu.org; Sun, 11 Sep 2005 10:12:51 -0400 Received: from techhouse.brown.edu (techhouse.brown.edu [138.16.60.2]) by pyxis.services.brown.edu (Switch-3.1.7/Switch-3.1.7/) with ESMTP id j8BECOX1018235; Sun, 11 Sep 2005 10:12:24 -0400 (EDT) Received: by techhouse.brown.edu (Postfix, from userid 580) id 75F32B90DB; Sun, 11 Sep 2005 10:12:24 -0400 (EDT) Date: Sun, 11 Sep 2005 10:12:24 -0400 To: Andreas Schwab Message-ID: <20050911141223.GA7409@techhouse.org> References: <090920052111.9659.4321FA9D0003619D000025BB22007358340A050E040D0C079D0A@comcast.net> <1126337506.282561.18957.nullmailer@Update.UU.SE> <20050910200009.GB26800@techhouse.org> <1126425917.496044.24245.nullmailer@Update.UU.SE> <20050911084128.GA4946@techhouse.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: dfeuer@techhouse.brown.edu (David Feuer) X-Brown-Proofpoint: Not Infected X-Proofpoint-Spam-Reason: safe Cc: bug-coreutils@gnu.org Subject: Re: Where can i get the design documentation for core utils? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 14:35:36 -0000 On Sun, Sep 11, 2005 at 03:15:26PM +0200, Andreas Schwab wrote: > dfeuer@techhouse.brown.edu (David Feuer) writes: > > > It is surely true that I am not the best programmer in the world. But > > when faced by things like glibc-2.3.5/locale/coll-lookup.c I suspect > > even a fancy New York keyboard jockey would wonder just what it was all > > about. > > It's actually rather easy to grok, just some multi-level table lookup, > with each level being indexed by different bit fields from the key as > described by the first five entries in the table. And the variable are > named with quite descriptive names. But what is being looked up in what table? The _purpose_ of a function should be described in internal documentation, unless it is really obvious. Wacky bit-shifting in unrolled loops can be easy to read, but only when documentation gives the reader a clue of the overall purpose and structure. You seem to prefer to blame C for the problem than the lack of documentation. C is not my favorite programming language either (I much prefer the strong type systems of ML and Haskell), but that's just not fair. It's possible to write perfectly readable code in any practical programming language. Please don't mention INTERCAL, unlambda, or anything like them. David From MAILER-DAEMON Sun Sep 11 19:36:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EEbN4-0006Sc-5D for mharc-bug-coreutils@gnu.org; Sun, 11 Sep 2005 19:36:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEbN1-0006Rk-GD for bug-coreutils@gnu.org; Sun, 11 Sep 2005 19:36:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEbMz-0006Qj-Pe for bug-coreutils@gnu.org; Sun, 11 Sep 2005 19:36:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEbKt-0005Lh-R9 for bug-coreutils@gnu.org; Sun, 11 Sep 2005 19:34:11 -0400 Received: from [134.68.220.30] (helo=smtp.gentoo.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EEavv-0001UY-Sc for bug-coreutils@gnu.org; Sun, 11 Sep 2005 19:08:24 -0400 Received: from localhost ([127.0.0.1] helo=home.wh0rd.org) by smtp.gentoo.org with esmtp (Exim 4.43) id 1EEavQ-0005VQ-2V for bug-coreutils@gnu.org; Sun, 11 Sep 2005 23:07:52 +0000 Received: (qmail 12566 invoked from network); 11 Sep 2005 19:05:27 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 11 Sep 2005 19:05:27 -0400 From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Date: Sun, 11 Sep 2005 19:08:07 -0400 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_XjLJD5VAo3bHtzW" Message-Id: <200509111908.07305.vapier@gentoo.org> Subject: add more terms to the list in dircolors.hin X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 23:36:23 -0000 --Boundary-00=_XjLJD5VAo3bHtzW Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline this patch adds more terminals to the colorize list: ansi color-xterm cons25 gnome konsole kterm rxvt-cygwin rxvt-cygwin-native screen.linux xterm-256color and it sorts it alphabetically so future additions are easier to manage -mike --Boundary-00=_XjLJD5VAo3bHtzW Content-Type: text/x-diff; charset="us-ascii"; name="dircolors-add-terms-and-sort.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dircolors-add-terms-and-sort.patch" Index: src/dircolors.hin =================================================================== RCS file: /cvsroot/coreutils/coreutils/src/dircolors.hin,v retrieving revision 1.20 diff -u -p -r1.20 dircolors.hin --- src/dircolors.hin 5 Sep 2005 17:11:39 -0000 1.20 +++ src/dircolors.hin 11 Sep 2005 23:07:33 -0000 @@ -5,10 +5,8 @@ # slackware version of dircolors) are recognized but ignored. # Below, there should be one TERM entry for each termtype that is colorizable -TERM linux -TERM linux-c -TERM mach-color -TERM console +TERM ansi +TERM color-xterm TERM con132x25 TERM con132x30 TERM con132x43 @@ -19,18 +17,30 @@ TERM con80x30 TERM con80x43 TERM con80x50 TERM con80x60 +TERM cons25 +TERM console TERM cygwin TERM dtterm +TERM Eterm +TERM gnome +TERM konsole +TERM kterm +TERM linux +TERM linux-c +TERM mach-color TERM putty -TERM xterm -TERM xterm-color -TERM xterm-debian TERM rxvt +TERM rxvt-cygwin +TERM rxvt-cygwin-native TERM screen TERM screen-bce TERM screen-w +TERM screen.linux TERM vt100 -TERM Eterm +TERM xterm +TERM xterm-256color +TERM xterm-color +TERM xterm-debian # Below are the color init strings for the basic file types. A color init # string consists of one or more of the following numeric codes: --Boundary-00=_XjLJD5VAo3bHtzW-- From MAILER-DAEMON Tue Sep 13 17:04:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFHx6-0001RM-F1 for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:04:28 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFHx0-0001Pp-SD for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:04:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFHwx-0001O0-EZ for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:04:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFHww-0001Mb-P3 for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:04:18 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFHvz-0006ji-Da for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:03:19 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DL3G414558 for ; Tue, 13 Sep 2005 14:03:16 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFHvw-0002SC-9J for bug-coreutils@gnu.org; Tue, 13 Sep 2005 14:03:16 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Tue, 13 Sep 2005 14:03:16 -0700 Message-ID: <877jdkznmz.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: CVS coreutils doesn't build due to xalloc.h reversion? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 21:04:24 -0000 CVS coreutils currently doesn't build out of the box since some of the code uses X2REALLOC and X2NREALLOC but these macros were removed from xalloc.h. Was the removal intentional? If so, uses of X2REALLOC need to be replaced by x2realloc elsewhere. Personally I'm becoming more inclined to not use those macros, as in practice I'm finding the readability confusion to be more than any potential reliability improvement. But it's not a big deal either way. Or perhaps you meant to move the macro defns to system.h? That would be fine as well, and a bit more modular. From MAILER-DAEMON Tue Sep 13 17:42:40 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFIMl-0007QT-R9 for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:30:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFIME-0007Hs-Pp for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:30:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFIM6-0007Es-Fo for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:30:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFIM6-00079K-7F for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:30:18 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFIEa-0008J2-QY for bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:22:33 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id AE54F12D8; Tue, 13 Sep 2005 23:22:31 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <877jdkznmz.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Tue, 13 Sep 2005 14:03:16 -0700") References: <877jdkznmz.fsf@penguin.cs.ucla.edu> Date: Tue, 13 Sep 2005 23:22:31 +0200 Message-ID: <87y860k6i0.fsf@rho.meyering.net> Lines: 74 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: CVS coreutils doesn't build due to xalloc.h reversion? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 21:30:32 -0000 Paul Eggert wrote: > CVS coreutils currently doesn't build out of the box since some of the > code uses X2REALLOC and X2NREALLOC but these macros were removed from > xalloc.h. Was the removal intentional? If so, uses of X2REALLOC need > to be replaced by x2realloc elsewhere. > > Personally I'm becoming more inclined to not use those macros, as in > practice I'm finding the readability confusion to be more than any > potential reliability improvement. But it's not a big deal either > way. > > Or perhaps you meant to move the macro defns to system.h? That would > be fine as well, and a bit more modular. That was inadvertent. Thanks for pointing it out. I've just restored those definitions, for now. I used gnulib-tool to import the latest into another project (cppi) that still had symlinked ,v files pointing into coreutils repository. When I committed things for cppi, that clobbered the file in coreutils. If no one else likes these macros, I'll move them to system.h, but I do think they're worth the added safety (at least for X2REALLOC) and improved readability (eliminating the often-redundant `sizeof VAR'). For examples, look in coreutils/src/*.c: rho$ grep -E 'X2N?REALLOC' *.c chmod.c: mode = X2REALLOC (mode, &mode_alloc); csplit.c: controls = X2NREALLOC (controls, &control_allocated); cut.c: (rp) = X2NREALLOC (rp, &n_rp_allocated); \ expand.c: tab_list = X2NREALLOC (tab_list, &n_tabs_allocated); fold.c: line_out = X2REALLOC (line_out, &allocated_out); join.c: line->fields = X2NREALLOC (line->fields, &line->nfields_allocated); join.c: seq->lines = X2NREALLOC (seq->lines, &seq->alloc); od.c: spec = X2NREALLOC (spec, &n_specs_allocated); od.c: buf = X2REALLOC (buf, &bufsize); pr.c: = X2REALLOC (column_count_string, &n_alloc); pr.c: buff = X2REALLOC (buff, &buff_allocated); sort.c: temp_dirs = X2NREALLOC (temp_dirs, &temp_dir_alloc); sort.c: buf->buf = X2REALLOC (buf->buf, &buf->alloc); unexpand.c: tab_list = X2NREALLOC (tab_list, &n_tabs_allocated); Most of those now fit on one line, but before the conversion, many did not, and hence were a little less readable. Using the macro to eliminate the `sizeof VAR' parameter makes the code more maintainable, too, imho. For the lurkers, here's a change that was representative of the conversion: diff -u -p -u -r1.142 -r1.143 --- join.c 9 Jul 2005 22:10:39 -0000 1.142 +++ join.c 12 Aug 2005 07:16:25 -0000 1.143 @@ -188,8 +188,7 @@ extract_field (struct line *line, char * { if (line->nfields >= line->nfields_allocated) { - line->fields = x2nrealloc (line->fields, &line->nfields_allocated, - sizeof (struct field)); + line->fields = X2NREALLOC (line->fields, &line->nfields_allocated); } line->fields[line->nfields].beg = field; line->fields[line->nfields].len = len; @@ -283,7 +282,7 @@ static bool getseq (FILE *fp, struct seq *seq) { if (seq->count == seq->alloc) - seq->lines = x2nrealloc (seq->lines, &seq->alloc, sizeof *seq->lines); + seq->lines = X2NREALLOC (seq->lines, &seq->alloc); if (get_line (fp, &seq->lines[seq->count])) { From MAILER-DAEMON Tue Sep 13 17:43:27 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFIYp-0001Wn-5d for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 17:43:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFAuf-0001m3-UJ for bug-coreutils@gnu.org; Tue, 13 Sep 2005 09:33:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFAuW-0001hd-9k for bug-coreutils@gnu.org; Tue, 13 Sep 2005 09:33:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFAuV-0001gq-Dy for bug-coreutils@gnu.org; Tue, 13 Sep 2005 09:33:19 -0400 Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFAt4-0003bp-RH for bug-coreutils@gnu.org; Tue, 13 Sep 2005 09:31:50 -0400 Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.34) id 1EFAt4-0006AW-6o for bug-sh-utils@gnu.org; Tue, 13 Sep 2005 09:31:50 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1EFAhS-0002yp-0e for bug-sh-utils@gnu.org; Tue, 13 Sep 2005 09:19:52 -0400 Received: from [15.219.201.134] (helo=bgerelbas01.asiapac.hp.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EFAhR-0002vP-IF for bug-sh-utils@gnu.org; Tue, 13 Sep 2005 09:19:49 -0400 Received: from bgeexg11.asiapacific.cpqcorp.net (bgeexg11.asiapacific.cpqcorp.net [16.150.33.26]) by bgerelbas01.asiapac.hp.net (Postfix) with ESMTP id 96ECF32EE1 for ; Tue, 13 Sep 2005 09:19:29 -0400 (EDT) Received: from bgeexc01.asiapacific.cpqcorp.net ([16.150.33.37]) by bgeexg11.asiapacific.cpqcorp.net with Microsoft SMTPSVC(6.0.3790.211); Tue, 13 Sep 2005 18:49:29 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Sep 2005 18:49:28 +0530 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Possible bug in uname command Thread-Index: AcW4ZcTfHLJ6CUkxQXuRMal3lEJb0w== From: "Asif Iqbal, Trumboo" To: X-OriginalArrivalTime: 13 Sep 2005 13:19:29.0516 (UTC) FILETIME=[C58802C0:01C5B865] X-Mailman-Approved-At: Tue, 13 Sep 2005 17:43:25 -0400 Cc: Subject: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 13:33:34 -0000 Dear Sir, There seems to be a possible bug in uname command on most versions of the Linux system. uname -p prints 'unknown' instead of the host processor name. Please look into the matter. Thanks and Regards, Asif Iqbal Trumboo From MAILER-DAEMON Tue Sep 13 18:07:27 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFIw3-00006t-8I for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:07:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFIw0-00005I-Gz for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:07:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFIvq-0008SC-S4 for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:07:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFIvq-0008RQ-Py for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:07:14 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFItw-0003Bh-3f for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:05:17 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DM5F420427 for ; Tue, 13 Sep 2005 15:05:15 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFItv-0006P5-3m for bug-coreutils@gnu.org; Tue, 13 Sep 2005 15:05:15 -0700 To: bug-coreutils@gnu.org References: <877jdkznmz.fsf@penguin.cs.ucla.edu> <87y860k6i0.fsf@rho.meyering.net> From: Paul Eggert Date: Tue, 13 Sep 2005 15:05:15 -0700 In-Reply-To: <87y860k6i0.fsf@rho.meyering.net> (Jim Meyering's message of "Tue, 13 Sep 2005 23:22:31 +0200") Message-ID: <873bo8zkro.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: CVS coreutils doesn't build due to xalloc.h reversion? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 22:07:25 -0000 Jim Meyering writes: > If no one else likes these macros, I'll move them to system.h, > but I do think they're worth the added safety (at least for X2REALLOC) > and improved readability (eliminating the often-redundant `sizeof VAR'). Naah, you convinced me. Let's migrate them into gnulib, but I guess I should look into changing xalloc.h to use verify.h first? From MAILER-DAEMON Tue Sep 13 18:36:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFJOR-0006wk-5R for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:36:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFJHm-0005Qf-2K for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:29:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFJHb-0005Jv-9R for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:29:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFJHX-0005IY-Pv for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:29:39 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFJ9t-0004ln-BF for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:21:45 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DMLi421787 for ; Tue, 13 Sep 2005 15:21:44 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFJ9s-0006ah-Cc for bug-coreutils@gnu.org; Tue, 13 Sep 2005 15:21:44 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Tue, 13 Sep 2005 15:21:44 -0700 Message-ID: <87u0goy5fr.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: warning from Autoconf 2.59 for CVS coreutils configure.ac X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 22:36:45 -0000 I installed this to pacify Autoconf 2.59: 2005-09-13 Paul Eggert * configure.ac: Don't invoke AC_CONFIGURE_HOST directly; AB_INIT does it for us, and our invocation evokes a diagnostic from Autoconf 2.59. Index: configure.ac =================================================================== RCS file: /fetish/cu/configure.ac,v retrieving revision 1.63 retrieving revision 1.64 diff -p -u -r1.63 -r1.64 --- configure.ac 13 Sep 2005 13:53:55 -0000 1.63 +++ configure.ac 13 Sep 2005 22:20:25 -0000 1.64 @@ -36,7 +36,6 @@ AC_PROG_CPP AC_PROG_GCC_TRADITIONAL AC_PROG_RANLIB AC_PROG_LN_S -AC_CANONICAL_HOST AC_CHECK_FUNCS(uname, From MAILER-DAEMON Tue Sep 13 18:36:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFJOU-0006yI-CT for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:36:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFJOS-0006xS-RP for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:36:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFJHd-0005NO-R0 for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:30:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFJHd-0005GS-8E for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:29:45 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFJ4U-0004W2-RW for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:16:11 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DMG6421333; Tue, 13 Sep 2005 15:16:07 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFJ4Q-0006QC-NS; Tue, 13 Sep 2005 15:16:06 -0700 To: bug-coreutils@gnu.org References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> From: Paul Eggert Date: Tue, 13 Sep 2005 15:16:06 -0700 In-Reply-To: <85wtnhrj17.fsf@pi.meyering.net> (Jim Meyering's message of "Sat, 23 Jul 2005 11:03:32 +0200") Message-ID: <87y860y5p5.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jos@catnook.com Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 22:36:49 -0000 Jim Meyering writes: > Paul Eggert wrote: >> How about if we do it by supporting Internet RFC 3339 instead? > I like this. OK, I installed the patch below. Comments welcome. In particular, the new %:z, %::z, %:::z strftime formats are a bit weird-looking, but I couldn't think of anything better. >> So, for example: >> >> $ date -i >> 2005-07-22 09:13:17.959906-07:00 > > Normally I would object to a short-named option, but when > the alternative is having to distinguish --rfc-3339 from > --rfc-2822, I think it's justified. Unfortunately I ran into problems when implementing -i (--rfc-3339='clock') because the clock resolution turns out to be hard to get. On my host (Debian stable), for example, clock_getres returns a resolution of 10 ms, but the actual resolution of gettime is 1 microsecond. And time stamps may come from sources other than the hardware clock (e.g., -d, -f, -r) so it may be inappropriate to use the hardware clock resolution even if we could get it correctly. For now I left that part unimplemented, and so the patch below omits --rfc-3339='clock' and -i. 2005-09-13 Paul Eggert * NEWS: date has a new --rfc-3339 option, and the old --iso-8601 option is deprecated. date and ls also have new time format specifiers %:z, %::z, %:::z. * doc/coreutils.texi (Time conversion specifiers, Options for date): Document date --rfc-3339 and new specifiers %:z, %::z, %:::z. Use "date and time" consistently; the old version sometimes said "time and date". Fix a minor bug in the documentation for --rfc-2822: it claimed day-of-month < 10 had leading space, not leading zero. Use a consistent format for terms like "RFC". * lib/strftime.c (my_strftime): Add support for %:z, %::z, %:::z. Fix bug in formats like %2N. * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so remove the "=1". (TIME_SOEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put them there. (time_spec_string, time_spec): Hours and minutes must be at start now, so put them there. (rfc_2822_format): Now a string constant, not a boolean. All uses changed. (iso_8601_format, rfc_format): Remove. (RFC_3339_OPTION): New constant. (long_options): Add --rfc-3339. (usage): Add --rfc-3339. Don't mention --iso-8601. Mention %:z, %::z, %:::z. (main): Simplify calculation of 'format'; it was getting too hairy to follow. Add --rfc-3339. (show_date): Assume format arg is not NULL, which is the case now. The default code is moved to 'main'. This simplifies things and allows the default to be calculated just once. * tests/misc/date: Add tests for --rfc-3339. Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.308 diff -p -u -r1.308 NEWS --- NEWS 10 Sep 2005 14:07:59 -0000 1.308 +++ NEWS 13 Sep 2005 21:59:04 -0000 @@ -182,6 +182,11 @@ GNU coreutils NEWS cp and mv: the --reply=X option is deprecated + date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I) + option is deprecated; it still works, but new applications should avoid it. + date and ls's time formats now support new %:z, %::z, %:::z specifiers + for numeric time zone offsets like -07:00, -07:00:00, and -07. + dd has new iflag= and oflag= flags "binary" and "text", which have an effect only on nonstandard platforms that distinguish text from binary I/O. Index: doc/coreutils.texi =================================================================== RCS file: /fetish/cu/doc/coreutils.texi,v retrieving revision 1.279 diff -p -u -r1.279 coreutils.texi --- doc/coreutils.texi 9 Sep 2005 21:16:49 -0000 1.279 +++ doc/coreutils.texi 13 Sep 2005 21:59:07 -0000 @@ -11593,7 +11593,7 @@ is not set. @xref{TZ Variable,, Specify @cindex time formats @cindex formatting times If given an argument that starts with a @samp{+}, @command{date} prints the -current time and date (or the time and date specified by the +current date and time (or the date and time specified by the @option{--date} option, see below) in the format defined by that argument, which is similar to that of the @code{strftime} function. Except for conversion specifiers, which start with @samp{%}, characters in the @@ -11664,14 +11664,29 @@ This may be @samp{60} if leap seconds ar @item %X locale's time representation (e.g., @samp{23:13:48}) @item %z -@w{RFC 2822/ISO 8601} style numeric time zone (e.g., @samp{-0600} -or @samp{+0100}), or nothing if no +@w{@acronym{RFC} 2822/@acronym{ISO} 8601} style numeric time zone +(e.g., @samp{-0600} or @samp{+0530}), or nothing if no time zone is determinable. This value reflects the numeric time zone appropriate for the current time, using the time zone rules specified by the @env{TZ} environment variable. The time (and optionally, the time zone rules) can be overridden by the @option{--date} option. This is a @acronym{GNU} extension. +@item %:z +@w{@acronym{RFC} 3339/@acronym{ISO} 8601} style numeric time zone with +@samp{:} (e.g., @samp{-06:00} or @samp{+05:30}), or nothing if no time +zone is determinable. +This is a @acronym{GNU} extension. +@item %::z +Numeric time zone to the nearest second with @samp{:} (e.g., +@samp{-06:00:00} or @samp{+05:30:00}), or nothing if no time zone is +determinable. +This is a @acronym{GNU} extension. +@item %:::z +Numeric time zone with @samp{:} using the minimum necessary precision +(e.g., @samp{-06}, @samp{+05:30}, or @samp{-04:56:02}), or nothing if +no time zone is determinable. +This is a @acronym{GNU} extension. @item %Z alphabetic time zone abbreviation (e.g., @samp{EDT}), or nothing if no time zone is determinable. See @samp{%z} for how it is determined. @@ -11860,11 +11875,11 @@ is available, it is ignored. @cindex appropriate privileges If given an argument that does not start with @samp{+}, @command{date} sets -the system clock to the time and date specified by that argument (as +the system clock to the date and time specified by that argument (as described below). You must have appropriate privileges to set the system clock. The @option{--date} and @option{--set} options may not be used with such an argument. The @option{--universal} option may be used -with such an argument to indicate that the specified time and date are +with such an argument to indicate that the specified date and time are relative to Coordinated Universal Time rather than to the local time zone. @@ -11912,8 +11927,8 @@ The program accepts the following option @opindex tomorrow @opindex next @var{day} @opindex last @var{day} -Display the time and date specified in @var{datestr} instead of the -current time and date. @var{datestr} can be in almost any common +Display the date and time specified in @var{datestr} instead of the +current date and time. @var{datestr} can be in almost any common format. It can contain month names, time zones, @samp{am} and @samp{pm}, @samp{yesterday}, etc. For example, @option{--date="2004-02-27 14:19:13.489392193 +0530"} specifies the instant of time that is @@ -11926,38 +11941,17 @@ time zone that is 5 hours and 30 minutes @opindex -f @opindex --file Parse each line in @var{datefile} as with @option{-d} and display the -resulting time and date. If @var{datefile} is @samp{-}, use standard +resulting date and time. If @var{datefile} is @samp{-}, use standard input. This is useful when you have many dates to process, because the system overhead of starting up the @command{date} executable many times can be considerable. -@item -I[@var{timespec}] -@itemx --iso-8601[=@var{timespec}] -@opindex -I[@var{timespec}] -@opindex --iso-8601[=@var{timespec}] -Display the date using the @acronym{ISO} 8601 format, @samp{%Y-%m-%d}. - -The argument @var{timespec} specifies the number of additional -terms of the time to include. It can be one of the following: -@table @samp -@item auto -Print just the date. This is the default if @var{timespec} is omitted. - -@item hours -Append the hour of the day to the date. - -@item minutes -Append the hours and minutes. - -@item seconds -Append the hours, minutes, and seconds. - -@item ns -Append the hours, minutes, seconds, and nanoseconds. -@end table - -If showing any time terms, then include the time zone using the format -@samp{%z}. +@item -r @var{file} +@itemx --reference=@var{file} +@opindex -r +@opindex --reference +Display the date and time of the last modification of @var{file}, +instead of the current date and time. @item -R @itemx --rfc-822 @@ -11965,31 +11959,58 @@ If showing any time terms, then include @opindex -R @opindex --rfc-822 @opindex --rfc-2822 -Display the time and date using the format @samp{%a, %d %b %Y %H:%M:%S +Display the date and time using the format @samp{%a, %d %b %Y %H:%M:%S %z}, evaluated in the C locale so abbreviations are always in English. For example: @example -Fri,@ @ 1 Aug 2003 23:05:56 -0700 +Fri, 09 Sep 2005 13:51:39 -0700 @end example This format conforms to -@uref{ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt, RFC 2822} and -@uref{ftp://ftp.rfc-editor.org/in-notes/rfc822.txt, RFC 822}, the +@uref{ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt, Internet +@acronym{RFCs} 2822} and +@uref{ftp://ftp.rfc-editor.org/in-notes/rfc822.txt, 822}, the current and previous standards for Internet email. -@item -r @var{file} -@itemx --reference=@var{file} -@opindex -r -@opindex --reference -Display the time and date reference according to the last modification -time of @var{file}, instead of the current time and date. +@item --rfc-3339=@var{timespec} +@opindex --rfc-3339=@var{timespec} +Display the date using a format specified by +@uref{ftp://ftp.rfc-editor.org/in-notes/rfc3339.txt, Internet +@acronym{RFC} 3339}. This is a subset of the @acronym{ISO} 8601 +format, except that it also permits applications to use a space rather +than a @samp{T} to separate dates from times. Unlike the other +standard formats, @acronym{RFC} 3339 format is always suitable as +input for the @option{--date} (@option{-d}) and @option{--file} +(@option{-f}) options, regardless of the current locale. + +The argument @var{timespec} specifies how much of the time to include. +It can be one of the following: + +@table @samp +@item date +Print just the full-date, e.g., @samp{2005-09-14}. +This is equivalent to the format @samp{%Y-%m-%d}. + +@item seconds +Print the full-date and full-time separated by a space, e.g., +@samp{2005-09-14 00:56:06+05:30}. The output ends with a numeric +time-offset; here the @samp{+05:30} means that local time is five +hours and thirty minutes east of @acronym{UTC}. This is equivalent to +the format @samp{%Y-%m-%d %H:%M:%S%:z}. + +@item ns +Like @samp{seconds}, but also print nanoseconds, e.g., +@samp{2005-09-14 00:56:06.998458565+05:30}. +This is equivalent to the format @samp{%Y-%m-%d %H:%M:%S.%N%:z}. + +@end table @item -s @var{datestr} @itemx --set=@var{datestr} @opindex -s @opindex --set -Set the time and date to @var{datestr}. See @option{-d} above. +Set the date and time to @var{datestr}. See @option{-d} above. @item -u @itemx --utc @@ -12078,11 +12099,11 @@ date --set='+2 minutes' @end example @item -To print the date in the format specified by RFC-2822, -use @samp{date --rfc-2822}. I just did and saw this: +To print the date in @acronym{RFC} 2822 format, +use @samp{date --rfc-2822}. Here is some example output: @example -Thu, 31 Jul 2003 13:13:05 -0700 +Fri, 09 Sep 2005 13:51:39 -0700 @end example @anchor{%s-examples} Index: lib/strftime.c =================================================================== RCS file: /fetish/cu/lib/strftime.c,v retrieving revision 1.87 diff -p -u -r1.87 strftime.c --- lib/strftime.c 17 Aug 2005 19:55:52 -0000 1.87 +++ lib/strftime.c 13 Sep 2005 21:59:08 -0000 @@ -480,8 +480,11 @@ my_strftime (CHAR_T *s, size_t maxsize, int digits; /* Max digits for numeric format. */ int number_value; /* Numeric value to be printed. */ unsigned int u_number_value; /* (unsigned int) number_value. */ - bool negative_number; /* 1 if the number is negative. */ + bool negative_number; /* The number is negative. */ + bool always_output_a_sign; /* +/- should always be output. */ + int tz_colon_mask; /* Bitmask of where ':' should appear. */ const CHAR_T *subfmt; + CHAR_T sign_char; CHAR_T *bufp; CHAR_T buf[1 + (sizeof (int) < sizeof (time_t) ? INT_STRLEN_BOUND (time_t) @@ -489,6 +492,7 @@ my_strftime (CHAR_T *s, size_t maxsize, int width = -1; bool to_lowcase = false; bool to_uppcase = false; + size_t colons = 0; bool change_case = false; int format_char; @@ -592,6 +596,11 @@ my_strftime (CHAR_T *s, size_t maxsize, pad = *f; continue; + /* This influences the %z format. */ + case L_(':'): + colons++; + continue; + /* This changes textual output. */ case L_('^'): to_uppcase = true; @@ -650,6 +659,11 @@ my_strftime (CHAR_T *s, size_t maxsize, digits = d; \ negative_number = negative; \ u_number_value = v; goto do_signed_number +#define DO_TZ_OFFSET(d, negative, mask, v) \ + digits = d; \ + negative_number = negative; \ + tz_colon_mask = mask; \ + u_number_value = v; goto do_tz_offset #define DO_NUMBER_SPACEPAD(d, v) \ digits = d; \ number_value = v; goto do_number_spacepad @@ -857,6 +871,10 @@ my_strftime (CHAR_T *s, size_t maxsize, /* All numeric formats set DIGITS and NUMBER_VALUE (or U_NUMBER_VALUE) and then jump to one of these three labels. */ + do_tz_offset: + always_output_a_sign = true; + goto do_number_body; + do_number_spacepad: /* Force `_' flag unless overridden by `0' or `-' flag. */ if (pad != L_('0') && pad != L_('-')) @@ -868,6 +886,10 @@ my_strftime (CHAR_T *s, size_t maxsize, u_number_value = number_value; do_signed_number: + always_output_a_sign = false; + tz_colon_mask = 0; + + do_number_body: /* Format U_NUMBER_VALUE according to the MODIFIER flag. NEGATIVE_NUMBER is nonzero if the original number was negative; in this case it was converted directly to @@ -904,17 +926,24 @@ my_strftime (CHAR_T *s, size_t maxsize, do { + if (tz_colon_mask & 1) + *--bufp = ':'; + tz_colon_mask >>= 1; *--bufp = u_number_value % 10 + L_('0'); u_number_value /= 10; } - while (u_number_value != 0); + while (u_number_value != 0 || tz_colon_mask != 0); do_number_sign_and_padding: if (digits < width) digits = width; - if (negative_number) - *--bufp = L_('-'); + sign_char = (negative_number ? L_('-') + : always_output_a_sign ? L_('+') + : 0); + + if (sign_char) + *--bufp = sign_char; if (pad != L_('-')) { @@ -938,12 +967,12 @@ my_strftime (CHAR_T *s, size_t maxsize, if ((size_t) digits >= maxsize - i) return 0; - if (negative_number) + if (sign_char) { ++bufp; if (p) - *p++ = L_('-'); + *p++ = sign_char; ++i; } @@ -1012,7 +1041,9 @@ my_strftime (CHAR_T *s, size_t maxsize, goto bad_format; number_value = ns; - if (width != -1) + if (width == -1) + width = 9; + else { /* Take an explicit width less than 9 as a precision. */ int j; @@ -1020,7 +1051,7 @@ my_strftime (CHAR_T *s, size_t maxsize, number_value /= 10; } - DO_NUMBER (9, number_value); + DO_NUMBER (width, number_value); #endif case L_('n'): @@ -1093,6 +1124,7 @@ my_strftime (CHAR_T *s, size_t maxsize, while (t != 0); digits = 1; + always_output_a_sign = false; goto do_number_sign_and_padding; } @@ -1286,6 +1318,9 @@ my_strftime (CHAR_T *s, size_t maxsize, { int diff; + int hour_diff; + int min_diff; + int sec_diff; #if HAVE_TM_GMTOFF diff = tp->tm_gmtoff; #else @@ -1324,16 +1359,32 @@ my_strftime (CHAR_T *s, size_t maxsize, } #endif - if (diff < 0) + hour_diff = diff / 60 / 60; + min_diff = diff / 60 % 60; + sec_diff = diff % 60; + + switch (colons) { - add (1, *p = L_('-')); - diff = -diff; - } - else - add (1, *p = L_('+')); + case 0: /* +hhmm */ + DO_TZ_OFFSET (5, diff < 0, 0, hour_diff * 100 + min_diff); - diff /= 60; - DO_NUMBER (4, (diff / 60) * 100 + diff % 60); + case 1: tz_hh_mm: /* +hh:mm */ + DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff); + + case 2: tz_hh_mm_ss: /* +hh:mm:ss */ + DO_TZ_OFFSET (9, diff < 0, 044, + hour_diff * 10000 + min_diff * 100 + sec_diff); + + case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */ + if (sec_diff != 0) + goto tz_hh_mm_ss; + if (min_diff != 0) + goto tz_hh_mm; + DO_TZ_OFFSET (3, diff < 0, 0, hour_diff); + + default: + goto bad_format; + } } case L_('\0'): /* GNU extension: % at end of format. */ Index: src/date.c =================================================================== RCS file: /fetish/cu/src/date.c,v retrieving revision 1.155 diff -p -u -r1.155 date.c --- src/date.c 15 Aug 2005 12:16:54 -0000 1.155 +++ src/date.c 13 Sep 2005 21:59:08 -0000 @@ -47,37 +47,47 @@ static bool show_date (const char *forma enum Time_spec { - /* display only the date: 1999-03-25 */ - TIME_SPEC_DATE=1, - /* display date and hour: 1999-03-25T03-0500 */ - TIME_SPEC_HOURS, - /* display date, hours, and minutes: 1999-03-25T03:23-0500 */ - TIME_SPEC_MINUTES, - /* display date, hours, minutes, and seconds: 1999-03-25T03:23:14-0500 */ + /* Display only the date. */ + TIME_SPEC_DATE, + /* Display date, hours, minutes, and seconds. */ TIME_SPEC_SECONDS, - /* similar, but display nanoseconds: 1999-03-25T03:23:14,123456789-0500 */ - TIME_SPEC_NS + /* Similar, but display nanoseconds. */ + TIME_SPEC_NS, + + /* Put these last, since they aren't valid for --rfc-3339. */ + + /* Display date and hour. */ + TIME_SPEC_HOURS, + /* Display date, hours, and minutes. */ + TIME_SPEC_MINUTES }; static char const *const time_spec_string[] = { - "date", "hours", "minutes", "seconds", "ns", NULL + /* Put "hours" and "minutes" first, since they aren't valid for + --rfc-3339. */ + "hours", "minutes", + "date", "seconds", "ns", NULL }; static enum Time_spec const time_spec[] = { - TIME_SPEC_DATE, TIME_SPEC_HOURS, TIME_SPEC_MINUTES, TIME_SPEC_SECONDS, - TIME_SPEC_NS + TIME_SPEC_HOURS, TIME_SPEC_MINUTES, + TIME_SPEC_DATE, TIME_SPEC_SECONDS, TIME_SPEC_NS }; ARGMATCH_VERIFY (time_spec_string, time_spec); +/* A format suitable for Internet RFC 2822. */ +static char const rfc_2822_format[] = "%a, %d %b %Y %H:%M:%S %z"; + /* The name this program was run with, for error messages. */ char *program_name; -/* If nonzero, display an ISO 8601 format date/time string */ -static int iso_8601_format = 0; - -/* If true, display time in RFC-(2)822 format for mail or news. */ -static bool rfc_format = false; +/* For long options that have no equivalent short option, use a + non-character as a pseudo short option, starting with CHAR_MAX + 1. */ +enum +{ + RFC_3339_OPTION = CHAR_MAX + 1 +}; static char const short_options[] = "d:f:I::r:Rs:u"; @@ -85,10 +95,11 @@ static struct option const long_options[ { {"date", required_argument, NULL, 'd'}, {"file", required_argument, NULL, 'f'}, - {"iso-8601", optional_argument, NULL, 'I'}, + {"iso-8601", optional_argument, NULL, 'I'}, /* Deprecated. */ {"reference", required_argument, NULL, 'r'}, {"rfc-822", no_argument, NULL, 'R'}, {"rfc-2822", no_argument, NULL, 'R'}, + {"rfc-3339", required_argument, NULL, RFC_3339_OPTION}, {"set", required_argument, NULL, 's'}, {"uct", no_argument, NULL, 'u'}, {"utc", no_argument, NULL, 'u'}, @@ -128,14 +139,13 @@ Display the current time in the given FO \n\ -d, --date=STRING display time described by STRING, not `now'\n\ -f, --file=DATEFILE like --date once for each line of DATEFILE\n\ - -I[TIMESPEC], --iso-8601[=TIMESPEC] output date/time in ISO 8601 format.\n\ - TIMESPEC=`date' for date only (the default),\n\ - `hours', `minutes', `seconds', or `ns' for date and\n\ - time to the indicated precision.\n\ "), stdout); fputs (_("\ -r, --reference=FILE display the last modification time of FILE\n\ - -R, --rfc-2822 output RFC-2822 compliant date string\n\ + -R, --rfc-2822 output date and time in RFC 2822 format\n\ + --rfc-3339=TIMESPEC output date and time in RFC 3339 format.\n\ + TIMESPEC=`date', `seconds', or `ns' for\n\ + date and time to the indicated precision.\n\ -s, --set=STRING set time described by STRING\n\ -u, --utc, --universal print or set Coordinated Universal Time\n\ "), stdout); @@ -206,7 +216,10 @@ specifies Coordinated Universal Time. I %Y year\n\ "), stdout); fputs (_("\ - %z numeric timezone (e.g., -0400)\n\ + %z +hhmm numeric timezone (e.g., -0400)\n\ + %:z +hh:mm numeric timezone (e.g., -04:00)\n\ + %::z +hh:mm:ss numeric time zone (e.g., -04:00:00)\n\ + %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30)\n\ %Z alphabetic time zone abbreviation (e.g., EDT)\n\ \n\ By default, date pads numeric fields with zeroes.\n\ @@ -299,11 +312,10 @@ main (int argc, char **argv) const char *set_datestr = NULL; struct timespec when; bool set_date = false; - char *format; + char const *format = NULL; char *batch_file = NULL; char *reference = NULL; struct stat refstats; - int n_args; bool ok; int option_specified_date; @@ -317,45 +329,79 @@ main (int argc, char **argv) while ((optc = getopt_long (argc, argv, short_options, long_options, NULL)) != -1) - switch (optc) - { - case 'd': - datestr = optarg; - break; - case 'f': - batch_file = optarg; - break; - case 'I': - iso_8601_format = (optarg - ? XARGMATCH ("--iso-8601", optarg, - time_spec_string, time_spec) - : TIME_SPEC_DATE); - break; - case 'r': - reference = optarg; - break; - case 'R': - rfc_format = true; - break; - case 's': - set_datestr = optarg; - set_date = true; - break; - case 'u': - /* POSIX says that `date -u' is equivalent to setting the TZ - environment variable, so this option should do nothing other - than setting TZ. */ - if (putenv ("TZ=UTC0") != 0) - xalloc_die (); - TZSET; - break; - case_GETOPT_HELP_CHAR; - case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); - default: - usage (EXIT_FAILURE); - } + { + char const *new_format = NULL; - n_args = argc - optind; + switch (optc) + { + case 'd': + datestr = optarg; + break; + case 'f': + batch_file = optarg; + break; + case RFC_3339_OPTION: + { + static char const rfc_3339_format[][32] = + { + "%Y-%m-%d", + "%Y-%m-%d %H:%M:%S%:z", + "%Y-%m-%d %H:%M:%S.%N%:z" + }; + enum Time_spec i = + XARGMATCH ("--rfc-3339", optarg, + time_spec_string + 2, time_spec + 2); + new_format = rfc_3339_format[i]; + break; + } + case 'I': + { + static char const iso_8601_format[][32] = + { + "%Y-%m-%d", + "%Y-%m-%dT%H:%M:%S%z", + "%Y-%m-%dT%H:%M:%S,%N%z", + "%Y-%m-%dT%H%z", + "%Y-%m-%dT%H:%M%z" + }; + enum Time_spec i = + (optarg + ? XARGMATCH ("--iso-8601", optarg, time_spec_string, time_spec) + : TIME_SPEC_DATE); + new_format = iso_8601_format[i]; + break; + } + case 'r': + reference = optarg; + break; + case 'R': + new_format = rfc_2822_format; + break; + case 's': + set_datestr = optarg; + set_date = true; + break; + case 'u': + /* POSIX says that `date -u' is equivalent to setting the TZ + environment variable, so this option should do nothing other + than setting TZ. */ + if (putenv ("TZ=UTC0") != 0) + xalloc_die (); + TZSET; + break; + case_GETOPT_HELP_CHAR; + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); + default: + usage (EXIT_FAILURE); + } + + if (new_format) + { + if (format) + error (EXIT_FAILURE, 0, _("multiple output formats specified")); + format = new_format; + } + } option_specified_date = ((datestr ? 1 : 0) + (batch_file ? 1 : 0) @@ -375,37 +421,49 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (n_args > 1) + if (optind < argc) { - error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); - usage (EXIT_FAILURE); - } + if (optind + 1 < argc) + { + error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); + usage (EXIT_FAILURE); + } - if ((set_date || option_specified_date) - && n_args == 1 && argv[optind][0] != '+') - { - error (0, 0, _("\ -the argument %s lacks a leading `+';\n\ -When using an option to specify date(s), any non-option\n\ -argument must be a format string beginning with `+'."), - quote (argv[optind])); - usage (EXIT_FAILURE); + if (argv[optind][0] == '+') + { + if (format) + error (EXIT_FAILURE, 0, _("multiple output formats specified")); + format = argv[optind++] + 1; + } + else if (set_date || option_specified_date) + { + error (0, 0, + _("the argument %s lacks a leading `+';\n" + "When using an option to specify date(s), any non-option\n" + "argument must be a format string beginning with `+'."), + quote (argv[optind])); + usage (EXIT_FAILURE); + } } - /* Simply ignore --rfc-2822 if specified when setting the date. */ - if (rfc_format && !set_date && n_args > 0) + if (!format) { - error (0, 0, - _("a format string may not be specified when using\ - the --rfc-2822 (-R) option")); - usage (EXIT_FAILURE); + format = DATE_FMT_LANGINFO (); + if (! *format) + { + /* Do not wrap the following literal format string with _(...). + For example, suppose LC_ALL is unset, LC_TIME="POSIX", + and LANG="ko_KR". In that case, POSIX says that LC_TIME + determines the format and contents of date and time strings + written by date, which means "date" must generate output + using the POSIX locale; but adding _() would cause "date" + to use a Korean translation of the format. */ + format = "%a %b %e %H:%M:%S %Z %Y"; + } } - if (set_date) - datestr = set_datestr; - if (batch_file != NULL) - ok = batch_convert (batch_file, (n_args == 1 ? argv[optind] + 1 : NULL)); + ok = batch_convert (batch_file, format); else { bool valid_date = true; @@ -413,7 +471,7 @@ argument must be a format string beginni if (!option_specified_date && !set_date) { - if (n_args == 1 && argv[optind][0] != '+') + if (optind < argc) { /* Prepare to set system clock to the specified date/time given in the POSIX-format. */ @@ -424,14 +482,11 @@ argument must be a format string beginni (PDS_TRAILING_YEAR | PDS_CENTURY | PDS_SECONDS)); when.tv_nsec = 0; /* FIXME: posixtime should set this. */ - format = NULL; } else { /* Prepare to print the current date/time. */ - datestr = _("undefined"); gettime (&when); - format = (n_args == 1 ? argv[optind] + 1 : NULL); } } else @@ -446,10 +501,10 @@ argument must be a format string beginni } else { + if (set_datestr) + datestr = set_datestr; valid_date = get_date (&when, datestr, NULL); } - - format = (n_args == 1 ? argv[optind] + 1 : NULL); } if (! valid_date) @@ -481,35 +536,6 @@ static bool show_date (const char *format, struct timespec when) { struct tm *tm; - /* ISO 8601 formats. See below regarding %z */ - static char const * const iso_format_string[] = - { - "%Y-%m-%d", - "%Y-%m-%dT%H%z", - "%Y-%m-%dT%H:%M%z", - "%Y-%m-%dT%H:%M:%S%z", - "%Y-%m-%dT%H:%M:%S,%N%z" - }; - - if (format == NULL) - { - if (rfc_format) - format = "%a, %d %b %Y %H:%M:%S %z"; - else if (iso_8601_format) - format = iso_format_string[iso_8601_format - 1]; - else - { - char *date_fmt = DATE_FMT_LANGINFO (); - /* Do not wrap the following literal format string with _(...). - For example, suppose LC_ALL is unset, LC_TIME="POSIX", - and LANG="ko_KR". In that case, POSIX says that LC_TIME - determines the format and contents of date and time strings - written by date, which means "date" must generate output - using the POSIX locale; but adding _() would cause "date" - to use a Korean translation of the format. */ - format = *date_fmt ? date_fmt : "%a %b %e %H:%M:%S %Z %Y"; - } - } tm = localtime (&when.tv_sec); if (! tm) @@ -525,10 +551,10 @@ show_date (const char *format, struct ti { char *out; - if (rfc_format) + if (format == rfc_2822_format) setlocale (LC_TIME, "C"); out = xanstrftime (format, tm, 0, when.tv_nsec); - if (rfc_format) + if (format == rfc_2822_format) setlocale (LC_TIME, ""); puts (out); Index: tests/misc/date =================================================================== RCS file: /fetish/cu/tests/misc/date,v retrieving revision 1.12 diff -p -u -r1.12 date --- tests/misc/date 9 Sep 2005 07:22:27 -0000 1.12 +++ tests/misc/date 13 Sep 2005 21:59:08 -0000 @@ -166,19 +166,29 @@ my @Tests = # Ensure that we can parse MONTHNAME-DAY-YEAR. ['moname-d-y', '--iso -d May-23-2003', {OUT=>"2003-05-23"}], + ['moname-d-y-r', '--rfc-3339=date -d May-23-2003', {OUT=>"2003-05-23"}], ['epoch', '--iso=sec -d @31536000', {OUT=>"1971-01-01T00:00:00+0000"}], + ['epoch-r', '--rfc-3339=sec -d @31536000', + {OUT=>"1971-01-01 00:00:00+00:00"}], ['ns-10', '--iso=ns', '-d "1969-12-31 13:00:00.00000001-1100"', {OUT=>"1970-01-01T00:00:00,000000010+0000"}], + ['ns-10-r', '--rfc-3339=ns', '-d "1969-12-31 13:00:00.00000001-1100"', + {OUT=>"1970-01-01 00:00:00.000000010+00:00"}], ['ns-max32', '--iso=ns', '-d "2038-01-19 03:14:07.999999999"', {OUT=>"2038-01-19T03:14:07,999999999+0000"}], + ['ns-max32-r', '--rfc-3339=ns', '-d "2038-01-19 03:14:07.999999999"', + {OUT=>"2038-01-19 03:14:07.999999999+00:00"}], ['ns-relative', '--iso=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", {OUT=>"2000-06-15T09:43:58,111111021+0000"}], + ['ns-relativer', '--rfc-3339=ns', + "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", + {OUT=>"2000-06-15 09:43:58.111111021+00:00"}], # Since coreutils/lib/getdate.y revision 1.96 (post-coreutils-5.3.0), # a command like the following would mistakenly exit nonzero with an From MAILER-DAEMON Tue Sep 13 18:46:58 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFJYI-00012a-Ly for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:46:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFJYG-00010a-Aj for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:46:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFJYD-0000z5-Tg for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:46:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFJYD-0000yP-PM for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:46:53 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFJXc-0006Sc-2f for bug-coreutils@gnu.org; Tue, 13 Sep 2005 18:46:16 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DMkE423748 for ; Tue, 13 Sep 2005 15:46:14 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFJXa-0006cW-QS for bug-coreutils@gnu.org; Tue, 13 Sep 2005 15:46:14 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Tue, 13 Sep 2005 15:46:14 -0700 Message-ID: <87k6hky4ax.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: dd fixes for buffer-size calculation overflow, unnecessary fstat X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 22:46:57 -0000 I installed these miscellaneous patches to dd.c, prompted by my discovery the user can cause a buffer overflow by specifying weird block sizes. There's also a fix to avoid a call to stat in the usual case where ftruncate succeeds. 2005-09-13 Paul Eggert * src/dd.c: Detect some very unlikely buffer overflows. (INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros. (MAX_BLOCKSIZE): Now accepts an arg. All uses changed. (page_size): New var. (scanargs, skip, main): Use more-straightforward way to detect overflow. (dd_copy): Use page_size rather than invoking getpagesize. Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP. (main): Set page_size. Avoid a call to stat in the usual case where ftruncate succeeds. --- src/dd.c 9 Jul 2005 22:10:39 -0000 1.185 +++ src/dd.c 13 Sep 2005 22:43:11 -0000 1.186 @@ -81,11 +81,18 @@ static void process_signals (void); /* Default input and output blocksize. */ #define DEFAULT_BLOCKSIZE 512 -/* Maximum blocksize. Keep it smaller than SIZE_MAX, so that we can +/* How many bytes to add to the input and output block sizes before invoking + malloc. See dd_copy for details. INPUT_BLOCK_SLOP must be no less than + OUTPUT_BLOCK_SLOP. */ +#define INPUT_BLOCK_SLOP (2 * SWAB_ALIGN_OFFSET + 2 * page_size - 1) +#define OUTPUT_BLOCK_SLOP (page_size - 1) + +/* Maximum blocksize for the given SLOP. + Keep it smaller than SIZE_MAX - SLOP, so that we can allocate buffers that size. Keep it smaller than SSIZE_MAX, for the benefit of system calls like "read". And keep it smaller than OFF_T_MAX, for the benefit of the large-offset seek code. */ -#define MAX_BLOCKSIZE MIN (SIZE_MAX, MIN (SSIZE_MAX, OFF_T_MAX)) +#define MAX_BLOCKSIZE(slop) MIN (SIZE_MAX - (slop), MIN (SSIZE_MAX, OFF_T_MAX)) /* Conversions bit masks. */ enum @@ -128,6 +135,9 @@ static char const *input_file = NULL; /* The name of the output file, or NULL for the standard output. */ static char const *output_file = NULL; +/* The page size on this host. */ +static size_t page_size; + /* The number of bytes in which atomic reads are done. */ static size_t input_blocksize = 0; @@ -883,26 +893,25 @@ scanargs (int argc, char **argv) if (STREQ (name, "ibs")) { - invalid |= ! (0 < n && n <= MAX_BLOCKSIZE); + invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP)); input_blocksize = n; conversions_mask |= C_TWOBUFS; } else if (STREQ (name, "obs")) { - invalid |= ! (0 < n && n <= MAX_BLOCKSIZE); + invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (OUTPUT_BLOCK_SLOP)); output_blocksize = n; conversions_mask |= C_TWOBUFS; } else if (STREQ (name, "bs")) { - invalid |= ! (0 < n && n <= MAX_BLOCKSIZE); + invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP)); output_blocksize = input_blocksize = n; } else if (STREQ (name, "cbs")) { + invalid |= ! (0 < n && n <= SIZE_MAX); conversion_blocksize = n; - invalid |= (conversion_blocksize != n - || conversion_blocksize == 0); } else if (STREQ (name, "skip")) skip_records = n; @@ -1116,14 +1125,14 @@ static uintmax_t skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, char *buf) { - off_t offset = records * blocksize; + uintmax_t offset = records * blocksize; /* Try lseek and if an error indicates it was an inappropriate operation -- or if the the file offset is not representable as an off_t -- fall back on using read. */ errno = 0; - if ((uintmax_t) offset / blocksize == records + if (records <= OFF_T_MAX / blocksize && 0 <= skip_via_lseek (file, fdesc, offset, SEEK_CUR)) { if (fdesc == STDIN_FILENO) @@ -1332,7 +1341,6 @@ dd_copy (void) size_t partread = 0; int exit_status = EXIT_SUCCESS; - size_t page_size = getpagesize (); size_t n_bytes_read; /* Leave at least one extra byte at the beginning and end of `ibuf' @@ -1352,9 +1360,7 @@ dd_copy (void) It is necessary when accessing raw (i.e. character special) disk devices on Unixware or other SVR4-derived system. */ - real_buf = xmalloc (input_blocksize - + 2 * SWAB_ALIGN_OFFSET - + 2 * page_size - 1); + real_buf = xmalloc (input_blocksize + INPUT_BLOCK_SLOP); ibuf = real_buf; ibuf += SWAB_ALIGN_OFFSET; /* allow space for swab */ @@ -1363,7 +1369,7 @@ dd_copy (void) if (conversions_mask & C_TWOBUFS) { /* Page-align the output buffer, too. */ - real_obuf = xmalloc (output_blocksize + page_size - 1); + real_obuf = xmalloc (output_blocksize + OUTPUT_BLOCK_SLOP); obuf = ptr_align (real_obuf, page_size); } else @@ -1587,6 +1593,8 @@ main (int argc, char **argv) /* Arrange to close stdout if parse_long_options exits. */ atexit (close_stdout); + page_size = getpagesize (); + parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION, usage, AUTHORS, (char const *) NULL); if (getopt_long (argc, argv, "", NULL, NULL) != -1) @@ -1643,28 +1651,30 @@ main (int argc, char **argv) #if HAVE_FTRUNCATE if (seek_records != 0 && !(conversions_mask & C_NOTRUNC)) { - struct stat stdout_stat; - off_t o = seek_records * output_blocksize; - uintmax_t uo = o; - if (uo / output_blocksize != seek_records) - error (EXIT_FAILURE, 0, _("file offset out of range")); - - if (fstat (STDOUT_FILENO, &stdout_stat) != 0) - error (EXIT_FAILURE, errno, _("cannot fstat %s"), - quote (output_file)); - - /* Complain only when ftruncate fails on a regular file, a - directory, or a shared memory object, as - POSIX 1003.1-2004 specifies ftruncate's behavior only for these - file types. For example, do not complain when Linux 2.4 - ftruncate fails on /dev/fd0. */ - if (ftruncate (STDOUT_FILENO, o) != 0 - && (S_ISREG (stdout_stat.st_mode) + uintmax_t size = seek_records * output_blocksize; + + if (OFF_T_MAX / output_blocksize < seek_records) + error (EXIT_FAILURE, EOVERFLOW, "seek=%"PRIuMAX"", seek_records); + + if (ftruncate (STDOUT_FILENO, size) != 0) + { + /* Complain only when ftruncate fails on a regular file, a + directory, or a shared memory object, as POSIX 1003.1-2004 + specifies ftruncate's behavior only for these file types. + For example, do not complain when Linux 2.4 ftruncate + fails on /dev/fd0. */ + int ftruncate_errno = errno; + struct stat stdout_stat; + if (fstat (STDOUT_FILENO, &stdout_stat) != 0) + error (EXIT_FAILURE, errno, _("cannot fstat %s"), + quote (output_file)); + if (S_ISREG (stdout_stat.st_mode) || S_ISDIR (stdout_stat.st_mode) - || S_TYPEISSHM (&stdout_stat))) - error (EXIT_FAILURE, errno, - _("advancing past %"PRIuMAX" bytes in output file %s"), - uo, quote (output_file)); + || S_TYPEISSHM (&stdout_stat)) + error (EXIT_FAILURE, ftruncate_errno, + _("truncating at %"PRIuMAX" bytes in output file %s"), + size, quote (output_file)); + } } #endif } From MAILER-DAEMON Tue Sep 13 19:04:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFJos-0004CF-8D for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:04:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFJoo-0004Bc-Tb for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:04:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFJon-0004B0-KQ for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:04:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFJon-0004AH-Da for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:04:01 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFJnr-0007G0-60 for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:03:03 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DN2m425051; Tue, 13 Sep 2005 16:02:48 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFJnc-0006gG-2l; Tue, 13 Sep 2005 16:02:48 -0700 To: "Asif Iqbal, Trumboo" References: From: Paul Eggert Date: Tue, 13 Sep 2005 16:02:48 -0700 In-Reply-To: (Asif Iqbal's message of "Tue, 13 Sep 2005 18:49:28 +0530") Message-ID: <87fys8y3jb.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 23:04:04 -0000 "Asif Iqbal, Trumboo" writes: > There seems to be a possible bug in uname command on most versions of > the Linux system. > uname -p prints 'unknown' instead of the host processor name. As I understand it, that is a deficiency in the Linux API rather than a bug in coreutils proper: Linux doesn't support the relevant sysinfo (Solaris-style) or sysctl (BSD-style) system calls. Perhaps you can report the problem to the Linux kernel folks. In the meantime I installed the following documentation patch to coreutils. 2005-09-13 Paul Eggert * doc/coreutils.texi (uname invocation): Mention that Linux outputs "unknown" for -i and -p. --- doc/coreutils.texi 13 Sep 2005 22:07:58 -0000 1.280 +++ doc/coreutils.texi 13 Sep 2005 23:01:59 -0000 1.282 @@ -12225,6 +12225,8 @@ Print all of the below information. @cindex platform, hardware Print the hardware platform name (sometimes called the hardware implementation). +Print @samp{unknown} if the kernel does not make this information +easily available, as is the case with Linux kernels. @item -m @itemx --machine @@ -12252,6 +12254,8 @@ Print the network node hostname. @cindex host processor type Print the processor type (sometimes called the instruction set architecture or ISA). +Print @samp{unknown} if the kernel does not make this information +easily available, as is the case with Linux kernels. @item -o @itemx --operating-system From MAILER-DAEMON Tue Sep 13 19:35:18 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFKJ3-0001fk-4q for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:35:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFKIx-0001dV-0f for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:35:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFKIl-0001XA-EK for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:35:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFKIi-0001UH-PR for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:34:56 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFKHf-0000hZ-TU for bug-coreutils@gnu.org; Tue, 13 Sep 2005 19:33:52 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8DNXo427316 for ; Tue, 13 Sep 2005 16:33:50 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFKHe-0006in-PT for bug-coreutils@gnu.org; Tue, 13 Sep 2005 16:33:50 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Tue, 13 Sep 2005 16:33:50 -0700 Message-ID: <87vf14wnj5.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: md5 merge from glibc, plus sha1 fixes X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 23:35:14 -0000 I installed this: 2005-09-13 Paul Eggert Merge md5 from libc, and clean up some sha1 glitches. * md5.h (__GNUC_PREREQ, __THROW, __attribute__): New macros. (__md5_buffer): Renamed from md5_buffer. Add a macro undoing this if _LIBC is not defined. Add __THROW. (__md5_finish_ctx, __md5_init_ctx, __md5_process_block): (__md5_process_bytes, __md5_read_ctx, __md5_stream): Likewise. (struct md5_ctx): Mark buffer as being aligned. (rol): Remove; all uses changed to CYCLIC. * md5.c (CYCLIC): New macro. All uses of rol changed to use CYCLIC. Redo comment to minimize changes from libc. * sha1.h (struct sha1_ctx): Mark buffer as being aligned. * sha1.c (SWAP): Renamed from NOTSWAP, to avoid a horrible misnaming. All uses changed. Remove the old SWAP. Remove obvious comment about BLOCKSIZE. (rol): New macro, moved here from md5.h. (sha1_process_block): Remove an incoherent FIXME comment. Index: lib/md5.c =================================================================== RCS file: /fetish/cu/lib/md5.c,v retrieving revision 1.24 diff -p -u -r1.24 md5.c --- lib/md5.c 27 Aug 2005 16:11:43 -0000 1.24 +++ lib/md5.c 13 Sep 2005 23:24:30 -0000 @@ -57,7 +57,6 @@ #endif #define BLOCKSIZE 4096 -/* Ensure that BLOCKSIZE is a multiple of 64. */ #if BLOCKSIZE % 64 != 0 # error "invalid BLOCKSIZE" #endif @@ -334,15 +333,22 @@ md5_process_block (const void *buffer, s { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ - a = rol (a, s); \ + CYCLIC (a, s); \ a += b; \ } \ while (0) + /* It is unfortunate that C does not provide an operator for + cyclic rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) + /* Before we start, one word to the strange constants. They are defined in RFC 1321 as - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + + Here is an equivalent invocation using Perl: + perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ @@ -372,7 +378,7 @@ md5_process_block (const void *buffer, s do \ { \ a += f (b, c, d) + correct_words[k] + T; \ - a = rol (a, s); \ + CYCLIC (a, s); \ a += b; \ } \ while (0) Index: lib/md5.h =================================================================== RCS file: /fetish/cu/lib/md5.h,v retrieving revision 1.18 diff -p -u -r1.18 md5.h --- lib/md5.h 14 May 2005 07:58:06 -0000 1.18 +++ lib/md5.h 13 Sep 2005 23:24:30 -0000 @@ -1,8 +1,6 @@ -/* md5.h - Declaration of functions and data types used for MD5 sum - computing library functions. - - Copyright (C) 1995, 1996, 1999, 2000, 2003, 2004 Free Software - Foundation, Inc. +/* Declaration of functions and data types used for MD5 sum computing + library functions. + Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. @@ -33,6 +31,39 @@ # include #endif +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __THROW +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#ifndef __attribute__ +# if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__ +# define __attribute__(x) +# endif +#endif + +#ifndef _LIBC +# define __md5_buffer md5_buffer +# define __md5_finish_ctx md5_finish_ctx +# define __md5_init_ctx md5_init_ctx +# define __md5_process_block md5_process_block +# define __md5_process_bytes md5_process_bytes +# define __md5_read_ctx md5_read_ctx +# define __md5_stream md5_stream +#endif + typedef uint32_t md5_uint32; /* Structure to save state of computation between the single steps. */ @@ -45,7 +76,7 @@ struct md5_ctx md5_uint32 total[2]; md5_uint32 buflen; - char buffer[128]; + char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); }; /* @@ -55,21 +86,21 @@ struct md5_ctx /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ -extern void md5_init_ctx (struct md5_ctx *ctx); +extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ -extern void md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void __md5_process_block (const void *buffer, size_t len, + struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ -extern void md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void __md5_process_bytes (const void *buffer, size_t len, + struct md5_ctx *ctx) __THROW; /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little @@ -78,7 +109,7 @@ extern void md5_process_bytes (const voi IMPORTANT: On some systems it is required that RESBUF be correctly aligned for a 32 bits value. */ -extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); +extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; /* Put result from CTX in first 16 bytes following RESBUF. The result is @@ -87,20 +118,19 @@ extern void *md5_finish_ctx (struct md5_ IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); +extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ -extern int md5_stream (FILE *stream, void *resblock); +extern int __md5_stream (FILE *stream, void *resblock) __THROW; /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *md5_buffer (const char *buffer, size_t len, void *resblock); +extern void *__md5_buffer (const char *buffer, size_t len, + void *resblock) __THROW; -#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) ) - -#endif +#endif /* md5.h */ Index: lib/sha1.c =================================================================== RCS file: /fetish/cu/lib/sha1.c,v retrieving revision 1.7 diff -p -u -r1.7 sha1.c --- lib/sha1.c 27 Aug 2005 16:11:53 -0000 1.7 +++ lib/sha1.c 13 Sep 2005 23:24:31 -0000 @@ -35,23 +35,17 @@ # include "unlocked-io.h" #endif -/* - Not-swap is a macro that does an endian swap on architectures that are - big-endian, as SHA1 needs some data in a little-endian format -*/ +/* SWAP does an endian swap on architectures that are little-endian, + as SHA1 needs some data in a big-endian form. */ #ifdef WORDS_BIGENDIAN -# define NOTSWAP(n) (n) -# define SWAP(n) \ - (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +# define SWAP(n) (n) #else -# define NOTSWAP(n) \ +# define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) -# define SWAP(n) (n) #endif #define BLOCKSIZE 4096 -/* Ensure that BLOCKSIZE is a multiple of 64. */ #if BLOCKSIZE % 64 != 0 # error "invalid BLOCKSIZE" #endif @@ -87,11 +81,11 @@ sha1_init_ctx (struct sha1_ctx *ctx) void * sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) { - ((md5_uint32 *) resbuf)[0] = NOTSWAP (ctx->A); - ((md5_uint32 *) resbuf)[1] = NOTSWAP (ctx->B); - ((md5_uint32 *) resbuf)[2] = NOTSWAP (ctx->C); - ((md5_uint32 *) resbuf)[3] = NOTSWAP (ctx->D); - ((md5_uint32 *) resbuf)[4] = NOTSWAP (ctx->E); + ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); + ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); + ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); + ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); + ((md5_uint32 *) resbuf)[4] = SWAP (ctx->E); return resbuf; } @@ -117,8 +111,8 @@ sha1_finish_ctx (struct sha1_ctx *ctx, v memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ - *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = NOTSWAP (ctx->total[0] << 3); - *(md5_uint32 *) &ctx->buffer[bytes + pad] = NOTSWAP ((ctx->total[1] << 3) | + *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); + *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ @@ -316,6 +310,8 @@ sha1_process_block (const void *buffer, if (ctx->total[0] < len) ++ctx->total[1]; +#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ , (x[I&0x0f] = rol(tm, 1)) ) @@ -331,10 +327,9 @@ sha1_process_block (const void *buffer, { md5_uint32 tm; int t; - /* FIXME: see sha1.c for a better implementation. */ for (t = 0; t < 16; t++) { - x[t] = NOTSWAP (*words); + x[t] = SWAP (*words); words++; } Index: lib/sha1.h =================================================================== RCS file: /fetish/cu/lib/sha1.h,v retrieving revision 1.4 diff -p -u -r1.4 sha1.h --- lib/sha1.h 14 May 2005 07:58:07 -0000 1.4 +++ lib/sha1.h 13 Sep 2005 23:24:31 -0000 @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA1 sum library functions. - Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -33,7 +33,7 @@ struct sha1_ctx md5_uint32 total[2]; md5_uint32 buflen; - char buffer[128]; + char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); }; From MAILER-DAEMON Tue Sep 13 23:08:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFNd1-0005Vy-32 for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:08:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFNcy-0005Uo-6D for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:08:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFNcs-0005S6-TF for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:08:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFNcs-0005RR-Hr for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:07:58 -0400 Received: from [63.240.76.28] (helo=sccrmhc13.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFNak-00067N-Ie for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:05:46 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc13) with ESMTP id <2005091403054301300d641ne>; Wed, 14 Sep 2005 03:05:44 +0000 Message-ID: <43279388.3000002@byu.net> Date: Tue, 13 Sep 2005 21:05:44 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> In-Reply-To: <87fys8y3jb.fsf@penguin.cs.ucla.edu> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 03:08:05 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > > As I understand it, that is a deficiency in the Linux API rather than > a bug in coreutils proper: Linux doesn't support the relevant sysinfo > (Solaris-style) or sysctl (BSD-style) system calls. Perhaps you can > report the problem to the Linux kernel folks. What about parsing /proc/cpuinfo, on machines that have that? (Cygwin falls into the same camp as linux, where this information is in /proc/cpuinfo, but not available from any easy system call.) - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDJ5OH84KuGfSFAYARApHEAJ9rYI3q3EF8bVO/G5W7mDDvRrVUSwCfYUBL xTX4M5DVIUxlQbTNz+tfqf8= =18S5 -----END PGP SIGNATURE----- From MAILER-DAEMON Tue Sep 13 23:31:51 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFNzx-0002Jz-U0 for mharc-bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:31:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFNzp-0002Hn-Up for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:31:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFNzm-0002GM-60 for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:31:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFNzl-0002Fm-Sv for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:31:37 -0400 Received: from [63.240.76.49] (helo=sccrmhc14.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFNyd-0007Pc-3g for bug-coreutils@gnu.org; Tue, 13 Sep 2005 23:30:27 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc14) with ESMTP id <200509140330240140026rlae>; Wed, 14 Sep 2005 03:30:24 +0000 Message-ID: <43279950.8040805@byu.net> Date: Tue, 13 Sep 2005 21:30:24 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bug-coreutils@gnu.org References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> <87y860y5p5.fsf@penguin.cs.ucla.edu> In-Reply-To: <87y860y5p5.fsf@penguin.cs.ucla.edu> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 03:31:46 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Paul Eggert on 9/13/2005 4:16 PM: > > OK, I installed the patch below. Comments welcome. In particular, > the new %:z, %::z, %:::z strftime formats are a bit weird-looking, but > I couldn't think of anything better. All I could think of when the problem first came up was %Ez, since %E specifies alternate format, but that doesn't really fit the three formats you provided, so your choice seems great to me. > 2005-09-13 Paul Eggert > > * NEWS: date has a new --rfc-3339 option, and the old --iso-8601 > option is deprecated. date and ls also have new time format > specifiers %:z, %::z, %:::z. > * doc/coreutils.texi (Time conversion specifiers, Options for date): > Document date --rfc-3339 and new specifiers %:z, %::z, %:::z. Use > "date and time" consistently; the old version sometimes said "time > and date". Fix a minor bug in the documentation for --rfc-2822: > it claimed day-of-month < 10 had leading space, not leading zero. > Use a consistent format for terms like "RFC". > * lib/strftime.c (my_strftime): Add support for %:z, %::z, %:::z. > Fix bug in formats like %2N. > * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so > remove the "=1". > (TIME_SOEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put ^^^^ typo in the changelog > them there. > (time_spec_string, time_spec): Hours and minutes must be at > start now, so put them there. > (rfc_2822_format): Now a string constant, not a boolean. All uses > changed. > (iso_8601_format, rfc_format): Remove. > (RFC_3339_OPTION): New constant. > (long_options): Add --rfc-3339. > (usage): Add --rfc-3339. Don't mention --iso-8601. > Mention %:z, %::z, %:::z. > (main): Simplify calculation of 'format'; it was getting too hairy > to follow. Add --rfc-3339. > (show_date): Assume format arg is not NULL, which is the case > now. The default code is moved to 'main'. This simplifies things > and allows the default to be calculated just once. > * tests/misc/date: Add tests for --rfc-3339. > > Index: NEWS > =================================================================== > RCS file: /fetish/cu/NEWS,v > retrieving revision 1.308 > diff -p -u -r1.308 NEWS > --- NEWS 10 Sep 2005 14:07:59 -0000 1.308 > +++ NEWS 13 Sep 2005 21:59:04 -0000 > @@ -182,6 +182,11 @@ GNU coreutils NEWS > > cp and mv: the --reply=X option is deprecated > > + date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I) > + option is deprecated; it still works, but new applications should avoid it. > + date and ls's time formats now support new %:z, %::z, %:::z specifiers > + for numeric time zone offsets like -07:00, -07:00:00, and -07. What about du, pinky, pr, stat, and who, which also use a form of strftime? And what about the FIXME in uptime to use strftime? > > -@item -I[@var{timespec}] > -@itemx --iso-8601[=@var{timespec}] > -@opindex -I[@var{timespec}] > -@opindex --iso-8601[=@var{timespec}] > -Display the date using the @acronym{ISO} 8601 format, @samp{%Y-%m-%d}. Now that -I is deprecated, should it print a warning to stderr? Or just silently work for a couple of years until it is disabled? > + --rfc-3339=TIMESPEC output date and time in RFC 3339 format.\n\ > + TIMESPEC=`date', `seconds', or `ns' for\n\ > + date and time to the indicated precision.\n\ TIMESPEC was optional for -I; should it be optional for rfc-3339 as well? > fputs (_("\ > - %z numeric timezone (e.g., -0400)\n\ > + %z +hhmm numeric timezone (e.g., -0400)\n\ > + %:z +hh:mm numeric timezone (e.g., -04:00)\n\ > + %::z +hh:mm:ss numeric time zone (e.g., -04:00:00)\n\ > + %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30)\n\ I think the description of :, ::, and ::: would fit better in the optional flags section below, rather than having to respace all the interpreted % sequence listings because you listed them with %z. > Index: tests/misc/date > =================================================================== > RCS file: /fetish/cu/tests/misc/date,v > retrieving revision 1.12 > diff -p -u -r1.12 date > --- tests/misc/date 9 Sep 2005 07:22:27 -0000 1.12 > +++ tests/misc/date 13 Sep 2005 21:59:08 -0000 > @@ -166,19 +166,29 @@ my @Tests = Where are the tests for %::z and %:::z? - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDJ5lQ84KuGfSFAYARAlZdAJ9w3pm2nR1ldE0Atan5DQARcJk8EwCfYRTu jkHWqv3k8jz8WanPBYX6oRs= =MbGV -----END PGP SIGNATURE----- From MAILER-DAEMON Wed Sep 14 03:08:04 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFRNC-00079O-VD for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:08:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFRN6-00076W-NY for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:07:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFRMy-00073d-Ac for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:07:53 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFRMw-0006x4-Ey for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:07:46 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFRJh-0004of-9c for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:04:25 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8E74O421406 for ; Wed, 14 Sep 2005 00:04:24 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFRJg-0008CH-71 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 00:04:24 -0700 To: bug-coreutils@gnu.org References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> <87y860y5p5.fsf@penguin.cs.ucla.edu> <43279950.8040805@byu.net> From: Paul Eggert Date: Wed, 14 Sep 2005 00:04:24 -0700 In-Reply-To: <43279950.8040805@byu.net> (Eric Blake's message of "Tue, 13 Sep 2005 21:30:24 -0600") Message-ID: <87y860w2o7.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 07:07:58 -0000 Eric Blake writes: > All I could think of when the problem first came up was %Ez, since %E > specifies alternate format, but that doesn't really fit the three formats > you provided, so your choice seems great to me. Thanks. Also, %E is supposed to be about locales, but this stuff is locale-independent, so it didn't seem wise in that respect either. >> (TIME_SOEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put > ^^^^ > typo in the changelog Thanks; fixed. > What about du, pinky, pr, stat, and who, which also use a form of > strftime? And what about the FIXME in uptime to use strftime? You're right, du and pr are affected; I'll note that. The others aren't affected since the user can't specify the format. The FIXME can wait for someone who's inspired to fix it.... > Now that -I is deprecated, should it print a warning to stderr? Or just > silently work for a couple of years until it is disabled? For now let's leave it alone. Maybe later we can have it issue a warning, and remove it still later. No rush. > TIMESPEC was optional for -I; should it be optional for rfc-3339 as well? Yes, but that's a future extension, when we can get around to when supporting clock resolution is reliable. I'd like plain --rfc-3339 (-i) to output to the available resolution. But this is a bit tricky. > I think the description of :, ::, and ::: would fit better in the optional > flags section below, rather than having to respace all the interpreted > % sequence listings because you listed them with %z. Hmm, could be. Still, it'd be tricky there too. > Where are the tests for %::z and %:::z? Thanks for reminding me. I added some, which found a bug, which I fixed. I installed this. Thanks again for your quick and detailed review. Index: ChangeLog =================================================================== RCS file: /fetish/cu/ChangeLog,v retrieving revision 1.1437 diff -p -u -r1.1437 ChangeLog --- ChangeLog 13 Sep 2005 22:43:11 -0000 1.1437 +++ ChangeLog 14 Sep 2005 06:56:38 -0000 @@ -19,11 +19,11 @@ Autoconf 2.59. * NEWS: date has a new --rfc-3339 option, and the old --iso-8601 - option is deprecated. date and ls also have new time format + option is deprecated. date, du, ls, and pr also have new time format specifiers %:z, %::z, %:::z. * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so remove the "=1". - (TIME_SOEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put + (TIME_SPEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put them there. (time_spec_string, time_spec): Hours and minutes must be at start now, so put them there. @@ -39,7 +39,7 @@ (show_date): Assume format arg is not NULL, which is the case now. The default code is moved to 'main'. This simplifies things and allows the default to be calculated just once. - * tests/misc/date: Add tests for --rfc-3339. + * tests/misc/date: Add tests for --rfc-3339, %:z, %::z, %:::z. 2005-09-13 Jim Meyering Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.309 diff -p -u -r1.309 NEWS --- NEWS 13 Sep 2005 22:07:34 -0000 1.309 +++ NEWS 14 Sep 2005 06:56:38 -0000 @@ -184,8 +184,8 @@ GNU coreutils NEWS date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I) option is deprecated; it still works, but new applications should avoid it. - date and ls's time formats now support new %:z, %::z, %:::z specifiers - for numeric time zone offsets like -07:00, -07:00:00, and -07. + date, du, ls, and pr's time formats now support new %:z, %::z, %:::z + specifiers for numeric time zone offsets like -07:00, -07:00:00, and -07. dd has new iflag= and oflag= flags "binary" and "text", which have an effect only on nonstandard platforms that distinguish text from binary I/O. Index: lib/strftime.c =================================================================== RCS file: /fetish/cu/lib/strftime.c,v retrieving revision 1.88 diff -p -u -r1.88 strftime.c --- lib/strftime.c 13 Sep 2005 22:08:18 -0000 1.88 +++ lib/strftime.c 14 Sep 2005 06:56:38 -0000 @@ -1372,7 +1372,7 @@ my_strftime (CHAR_T *s, size_t maxsize, DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff); case 2: tz_hh_mm_ss: /* +hh:mm:ss */ - DO_TZ_OFFSET (9, diff < 0, 044, + DO_TZ_OFFSET (9, diff < 0, 024, hour_diff * 10000 + min_diff * 100 + sec_diff); case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */ Index: tests/misc/date =================================================================== RCS file: /fetish/cu/tests/misc/date,v retrieving revision 1.13 diff -p -u -r1.13 date --- tests/misc/date 13 Sep 2005 22:09:03 -0000 1.13 +++ tests/misc/date 14 Sep 2005 06:56:38 -0000 @@ -183,6 +183,16 @@ my @Tests = ['ns-max32-r', '--rfc-3339=ns', '-d "2038-01-19 03:14:07.999999999"', {OUT=>"2038-01-19 03:14:07.999999999+00:00"}], + ['tz-1', '+%:::z', {OUT=>"-12:34:56"}, {ENV=>'TZ=XXX12:34:56'}], + + ['tz-2', '+%:::z', {OUT=>"+12:34:56"}, {ENV=>'TZ=XXX-12:34:56'}], + + ['tz-3', '+%::z', {OUT=>"+01:02:03"}, {ENV=>'TZ=XXX-1:02:03'}], + + ['tz-4', '+%:::z', {OUT=>"+12"}, {ENV=>'TZ=XXX-12'}], + + ['tz-5', '+%:z', {OUT=>"-00:01"}, {ENV=>'TZ=XXX0:01'}], + ['ns-relative', '--iso=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", {OUT=>"2000-06-15T09:43:58,111111021+0000"}], From MAILER-DAEMON Wed Sep 14 03:18:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFRXZ-0001S4-9v for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:18:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFRXU-0001PE-W9 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:18:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFRXP-0001M6-5F for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:18:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFRXO-0001IL-IH for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:18:34 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFRWq-0006GE-Pt for bug-coreutils@gnu.org; Wed, 14 Sep 2005 03:18:01 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8E7Hx422318 for ; Wed, 14 Sep 2005 00:17:59 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFRWp-0008Cx-SN for bug-coreutils@gnu.org; Wed, 14 Sep 2005 00:17:59 -0700 To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> From: Paul Eggert Date: Wed, 14 Sep 2005 00:17:59 -0700 In-Reply-To: <43279388.3000002@byu.net> (Eric Blake's message of "Tue, 13 Sep 2005 21:05:44 -0600") Message-ID: <87slw8w21k.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 07:18:41 -0000 Eric Blake writes: > What about parsing /proc/cpuinfo, on machines that have that? That's been discussed, but it sounds like a can of worms. The information doesn't map all that well to the uname output, and my admittedly uninformed feeling is that it is not that standard among Linux versions. For example, on a Solaris 10 (sparc) box, uname -a might output this: SunOS otter 5.10 Generic_118822-11 sun4u sparc SUNW,Sun-Fire-V440 Solaris The "sparc" and "SUNW,Sun-Fire-V440" correspond to the --processor and --hardware-platform options that are unknown on Linux boxes. /proc/cpuinfo probably would say just "cpu family : 27" or something like that, which would be a pain to map to an actual name like "sparc". (Or perhaps uname could just output the "27"; doesn't sound that helpful, though.) And the "SUNW,Sun-Fire-V440" is more of a motherboard concept than a CPU concept; is there a /proc/motherboardinfo in Linux? Maybe if some Linux whiz wanted to maintain it as a nice dropin library. But personally I'd rather just have the Linux folks support this stuff in their system calls; that's where it belongs. From MAILER-DAEMON Wed Sep 14 06:15:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFUIJ-0002tH-1X for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 06:15:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFUIA-0002qY-TC for bug-coreutils@gnu.org; Wed, 14 Sep 2005 06:15:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFUI6-0002oA-7r for bug-coreutils@gnu.org; Wed, 14 Sep 2005 06:14:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFUI5-0002nu-T1 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 06:14:57 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFUFd-0004tA-OH for bug-coreutils@gnu.org; Wed, 14 Sep 2005 06:12:26 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 8008B12D8; Wed, 14 Sep 2005 12:12:24 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87y860y5p5.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Tue, 13 Sep 2005 15:16:06 -0700") References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> <87y860y5p5.fsf@penguin.cs.ucla.edu> Date: Wed, 14 Sep 2005 12:12:24 +0200 Message-ID: <87slw8j6uv.fsf@rho.meyering.net> Lines: 83 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jos@catnook.com, bug-coreutils@gnu.org Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 10:15:06 -0000 Paul Eggert wrote: > 2005-09-13 Paul Eggert > > * NEWS: date has a new --rfc-3339 option, and the old --iso-8601 > option is deprecated. date and ls also have new time format > specifiers %:z, %::z, %:::z. So my threat of incoming fprintftime changes motivated you, Eh? You got yours in first, so now *I* get to do the merge :-) But it wasn't too bad, and it turned up a bug. BTW, I don't like the fact that the new %:z formats zero-fill by default, when used with a wider field width, but I've left it as-is, for now. 2005-09-14 Jim Meyering * strftime.c (my_strftime): Parse the colons of %:::z *after* the optional field width, not before, so we accept %9:z, not %:9z. 2005-09-14 Jim Meyering * tests/misc/date (tz-5w, tz-5wf): Test new %:z format with a field width. Index: lib/strftime.c =================================================================== RCS file: /fetish/cu/lib/strftime.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -p -u -r1.89 -r1.90 --- lib/strftime.c 14 Sep 2005 06:58:08 -0000 1.89 +++ lib/strftime.c 14 Sep 2005 10:02:54 -0000 1.90 @@ -596,11 +596,6 @@ my_strftime (CHAR_T *s, size_t maxsize, pad = *f; continue; - /* This influences the %z format. */ - case L_(':'): - colons++; - continue; - /* This changes textual output. */ case L_('^'): to_uppcase = true; @@ -648,6 +643,19 @@ my_strftime (CHAR_T *s, size_t maxsize, break; } + /* Parse the colons of %:::z *after* the optional field width, + not before, so we accept %9:z, not %:9z. */ + { + const CHAR_T *q; + for (q = f; *q == ':' && q - f < 3; q++) + ; /* empty */ + if (*q == 'z') + { + colons = q - f; + f = q; + } + } + /* Now do the specified format. */ format_char = *f; switch (format_char) Index: tests/misc/date =================================================================== RCS file: /fetish/cu/tests/misc/date,v retrieving revision 1.14 retrieving revision 1.15 diff -u -p -u -r1.14 -r1.15 --- tests/misc/date 14 Sep 2005 06:58:44 -0000 1.14 +++ tests/misc/date 14 Sep 2005 09:54:15 -0000 1.15 @@ -193,6 +193,11 @@ my @Tests = ['tz-5', '+%:z', {OUT=>"-00:01"}, {ENV=>'TZ=XXX0:01'}], + # Accept %:z with a field width before the `:'. + ['tz-5w','+%8:z', {OUT=>"-0000:01"}, {ENV=>'TZ=XXX0:01'}], + # Don't recognize %:z with a field width between the `:' and the `z'. + ['tz-5wf', '+%:8z', {OUT=>"%:8z"}, {ENV=>'TZ=XXX0:01'}], + ['ns-relative', '--iso=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", {OUT=>"2000-06-15T09:43:58,111111021+0000"}], From MAILER-DAEMON Wed Sep 14 10:47:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFYY7-0008L9-Ae for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 10:47:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFWdJ-0006Y1-8q for bug-coreutils@gnu.org; Wed, 14 Sep 2005 08:45:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFWdH-0006XJ-PJ for bug-coreutils@gnu.org; Wed, 14 Sep 2005 08:45:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFWYW-00051S-9j for bug-coreutils@gnu.org; Wed, 14 Sep 2005 08:40:04 -0400 Received: from [216.16.235.2] (helo=nic.netdirect.ca) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EFWI8-0007hn-2G for bug-coreutils@gnu.org; Wed, 14 Sep 2005 08:23:08 -0400 X-Envelope-To: Received: from localhost (rubicon.netdirect.ca [216.16.235.2]) by nic.netdirect.ca (8.13.1/8.13.1) with ESMTP id j8ECE76L010257 for ; Wed, 14 Sep 2005 08:14:08 -0400 Date: Wed, 14 Sep 2005 08:14:07 -0400 From: Chris Frey To: bug-coreutils@gnu.org Message-ID: <20050914121407.GA9040@netdirect.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Net-Direct-Inc-MailScanner-Information: Please contact the ISP for more information X-Net-Direct-Inc-MailScanner: Found to be clean X-MailScanner-From: X-Mailman-Approved-At: Wed, 14 Sep 2005 10:47:44 -0400 Subject: [PATCH] split: adding --exec, --exec-wait, and --pause X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 12:45:01 -0000 Hi, This is an initial rough draft of a patch to add exec and pause support to the split command. The basic idea is to let the user have some control of what happens to each output file as it is created. A command may be run (say burning file chunks to CD), or split can pause for the user to press ENTER after each output file is closed. The new help options look like this: -e, --exec=CMD run CMD after each output file is closed -w, --exec-wait=CMD run CMD after each output file is closed and wait for the child to exit -p, --pause pause for keypress after each output file is closed I'm not happy with the futzing around with the STDIN_FILENO, as both exec and pause need to read from the user's terminal, not the data stream. What I've done is check if STDOUT_FILENO is a tty, and if so, open() it. This causes problems if you su to another user and your tty is owned by the first user, but I'm not sure how to get around that. This patch is in the public domain. Let me know what you think, - Chris --- split.c 2005-09-14 08:00:12.000000000 -0400 +++ split-cdf01.c 2005-09-14 07:59:48.000000000 -0400 @@ -76,6 +76,17 @@ output file is opened. */ static bool verbose; +/* If true, pause after each output file is closed, to let the user press + ENTER. Use tty_pause_fd for the I/O. */ +static bool pause_mode; +static int tty_pause_fd; + +/* The user-specified command to run after each output file is closed. + Run it through sprintf first in order to place the latest output + filename in the command */ +static char *exec_command; +static bool exec_wait; + /* For long options that have no equivalent short option, use a non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum @@ -91,6 +102,9 @@ {"suffix-length", required_argument, NULL, 'a'}, {"numeric-suffixes", no_argument, NULL, 'd'}, {"verbose", no_argument, NULL, VERBOSE_OPTION}, + {"pause", no_argument, NULL, 'p'}, + {"exec", required_argument, NULL, 'e'}, + {"exec-wait", required_argument, NULL, 'w'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -122,7 +136,11 @@ -b, --bytes=SIZE put SIZE bytes per output file\n\ -C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\ -d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\ + -e, --exec=CMD run CMD after each output file is closed\n\ + -w, --exec-wait=CMD run CMD after each output file is closed\n\ + and wait for the child to exit\n\ -l, --lines=NUMBER put NUMBER lines per output file\n\ + -p, --pause pause for keypress after each output file is closed\n\ "), DEFAULT_SUFFIX_LENGTH); fputs (_("\ --verbose print a diagnostic to standard error just\n\ @@ -195,6 +213,81 @@ } } + +static void +run_exec_command (void) +{ + int child_pid = fork(); + + if (child_pid == 0) + { + /* child process */ + char *cmd_line; + char tty_name[100]; + int stdin_fd; + + /* close all data files */ + close (STDIN_FILENO); + if (output_desc >= 0) + close (output_desc); + if (pause_mode) + close (tty_pause_fd); + + /* recreate a stdin for the child */ + if (ttyname_r(STDOUT_FILENO, tty_name, sizeof(tty_name)) != 0) + error (EXIT_FAILURE, errno, "can't discover tty name"); + stdin_fd = open (tty_name, O_RDWR); + if (stdin_fd == -1) + error (EXIT_FAILURE, errno, "can't open tty for " + "pause prompting"); + if (stdin_fd != STDIN_FILENO) + { + dup2 (stdin_fd, STDIN_FILENO); + close (stdin_fd); + } + + /* build the command line, passing a few filenames so the user + * can use multiple %s if he needs to... the cheap way */ + asprintf (&cmd_line, exec_command, outfile, outfile, outfile, outfile, + outfile, outfile, outfile); + + /* exec it */ + execl ("/bin/sh", "/bin/sh", "-c", cmd_line, NULL); + + /* exit with failure if we get here */ + exit (1); + } + else if (child_pid == -1) + { + /* parent process, child had problems */ + error (EXIT_FAILURE, errno, "can't fork to exec command"); + } + else + { + /* parent process, success */ + if (exec_wait) + waitpid (child_pid, NULL, 0); + } +} + + +static void +split_point (void) +{ + if (exec_command) + run_exec_command (); + + if (pause_mode) + { + char nothing; + write(tty_pause_fd, "Press ENTER to continue with next split file\n" + "Just finished: ", 60); + write(tty_pause_fd, outfile, strlen(outfile)); + read(tty_pause_fd, ¬hing, 1); + } +} + + /* Write BYTES bytes at BP to an output file. If NEW_FILE_FLAG is true, open the next output file. Otherwise add to the same output file already in use. */ @@ -206,6 +299,8 @@ { if (output_desc >= 0 && close (output_desc) < 0) error (EXIT_FAILURE, errno, "%s", outfile); + else if (output_desc >= 0) + split_point (); next_file_name (); if (verbose) @@ -406,7 +501,7 @@ /* This is the argv-index of the option we will read next. */ int this_optind = optind ? optind : 1; - c = getopt_long (argc, argv, "0123456789C:a:b:dl:", longopts, NULL); + c = getopt_long (argc, argv, "0123456789C:a:b:dl:pe:w:", longopts, NULL); if (c == -1) break; @@ -494,6 +589,43 @@ suffix_alphabet = "0123456789"; break; + case 'p': + pause_mode = true; + if (isatty(STDOUT_FILENO)) + { + /* we have a valid tty on stdout, let's try to open it for + * reading and writing (for the prompt), since stdin is + * being used for data */ + char tty_name[100]; + if (ttyname_r(STDOUT_FILENO, tty_name, sizeof(tty_name)) != 0) + error (EXIT_FAILURE, errno, "can't discover tty name"); + tty_pause_fd = open (tty_name, O_RDWR); + if (tty_pause_fd == -1) + error (EXIT_FAILURE, errno, "can't open tty for " + "pause prompting"); + } + else + { + error (EXIT_FAILURE, 0, "stdout is not a tty, can't prompt" + " on pause points"); + } + break; + + case 'e': + case 'w': + if (! exec_command) + { + size_t cmd_length = strlen(optarg); + exec_command = xmalloc (cmd_length + 1); + strcpy (exec_command, optarg); + + if (c == 'w') + exec_wait = true; + } + else + error (EXIT_FAILURE, 0, "exec already specified!"); + break; + case VERBOSE_OPTION: verbose = true; break; @@ -578,6 +710,8 @@ error (EXIT_FAILURE, errno, "%s", infile); if (output_desc >= 0 && close (output_desc) < 0) error (EXIT_FAILURE, errno, "%s", outfile); + else if (output_desc >= 0) + split_point (); exit (EXIT_SUCCESS); } From MAILER-DAEMON Wed Sep 14 12:00:02 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFZg0-0002YJ-FZ for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:00:00 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFZfq-0002St-Ef for bug-coreutils@gnu.org; Wed, 14 Sep 2005 11:59:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFZfn-0002RK-9t for bug-coreutils@gnu.org; Wed, 14 Sep 2005 11:59:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFZfm-0002Hn-H8 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 11:59:46 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFZfk-0003aQ-4N for bug-coreutils@gnu.org; Wed, 14 Sep 2005 11:59:44 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 6F1DE4B2E8 for ; Wed, 14 Sep 2005 09:59:42 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 6E050156573; Wed, 14 Sep 2005 09:59:42 -0600 (MDT) Date: Wed, 14 Sep 2005 09:59:42 -0600 To: bug-coreutils@gnu.org Message-ID: <20050914155942.GA23350@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87slw8w21k.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 15:59:52 -0000 Paul Eggert wrote: > That's been discussed, but it sounds like a can of worms. I have often thought it would be better if on machines that could not reasonably support those extra uname options that the options be disabled entirely. Then instead of unknown the program would report it as an invalid option. Bob From MAILER-DAEMON Wed Sep 14 12:12:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFZsO-0008Cp-2I for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFZsI-0008At-8T for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFZsC-00087m-A2 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFZsB-00087H-W8 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:36 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFZrm-00050d-Ik for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:10 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 26AF6471; Wed, 14 Sep 2005 18:12:09 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26636; Wed, 14 Sep 05 18:11:59 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 62DAD564; Wed, 14 Sep 2005 18:11:57 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 25FAC44003; Wed, 14 Sep 2005 18:11:57 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 27071-03-36; Wed, 14 Sep 2005 18:11:56 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 813B444002; Wed, 14 Sep 2005 18:11:56 +0200 (CEST) Received: (nullmailer pid 20553 invoked by uid 30270); Wed, 14 Sep 2005 16:11:56 -0000 From: "Alfred M\. Szmidt" To: bob@proulx.com (Bob Proulx) In-reply-to: <20050914155942.GA23350@dementia.proulx.com> (bob@proulx.com) References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> Date: Wed, 14 Sep 2005 18:11:56 +0200 Message-Id: <1126714316.287418.20552.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 16:12:45 -0000 > That's been discussed, but it sounds like a can of worms. I have often thought it would be better if on machines that could not reasonably support those extra uname options that the options be disabled entirely. Then instead of unknown the program would report it as an invalid option. But that will break scripts like mad... :( From MAILER-DAEMON Wed Sep 14 12:14:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFZu8-0000IA-O9 for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFZu7-0000Hq-4L for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFZu5-0000HA-2q for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFZu4-0000Fn-R1 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:32 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFZsf-00059N-88 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:13:05 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 024A7127B; Wed, 14 Sep 2005 18:13:03 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87slw8j6uv.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 14 Sep 2005 12:12:24 +0200") References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> <87y860y5p5.fsf@penguin.cs.ucla.edu> <87slw8j6uv.fsf@rho.meyering.net> Date: Wed, 14 Sep 2005 18:13:03 +0200 Message-ID: <87slw7iq5s.fsf@rho.meyering.net> Lines: 39 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jos@catnook.com, bug-coreutils@gnu.org Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 16:14:35 -0000 Jim Meyering wrote: ... > 2005-09-14 Jim Meyering > > * strftime.c (my_strftime): Parse the colons of %:::z *after* the > optional field width, not before, so we accept %9:z, not %:9z. > > 2005-09-14 Jim Meyering > > * tests/misc/date (tz-5w, tz-5wf): Test new %:z format with > a field width. On rereading that patch, I just caught this: 2005-09-14 Jim Meyering ... (my_strftime): Be sure to use L_('x') for literals. Index: lib/strftime.c =================================================================== RCS file: /fetish/cu/lib/strftime.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -p -u -r1.90 -r1.91 --- lib/strftime.c 14 Sep 2005 10:02:54 -0000 1.90 +++ lib/strftime.c 14 Sep 2005 16:10:38 -0000 1.91 @@ -647,9 +647,9 @@ my_strftime (CHAR_T *s, size_t maxsize, not before, so we accept %9:z, not %:9z. */ { const CHAR_T *q; - for (q = f; *q == ':' && q - f < 3; q++) + for (q = f; *q == L_(':') && q - f < 3; q++) ; /* empty */ - if (*q == 'z') + if (*q == L_('z')) { colons = q - f; f = q; From MAILER-DAEMON Wed Sep 14 13:10:25 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFam8-0003JK-Rp for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:10:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFam7-0003IF-6Y for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:10:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFam5-0003G9-0q for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:10:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFaiX-0001Oz-2s for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:06:41 -0400 Received: from [204.127.198.35] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFaNu-0007mR-Rl for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:45:22 -0400 Received: from 204.127.197.111 (rmailcenter16.comcast.net[204.127.197.126]) by comcast.net (rwcrmhc11) with SMTP id <2005091416452101300ppnbne>; Wed, 14 Sep 2005 16:45:21 +0000 Received: from [128.170.36.44] by 204.127.197.111; Wed, 14 Sep 2005 16:45:20 +0000 From: ericblake@comcast.net (Eric Blake) To: bug-coreutils@gnu.org Date: Wed, 14 Sep 2005 16:45:20 +0000 Message-Id: <091420051645.3130.432853A0000CDC1400000C3A22058864420A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 17:10:23 -0000 > > That's been discussed, but it sounds like a can of worms. > > I have often thought it would be better if on machines that could > not reasonably support those extra uname options that the options > be disabled entirely. Then instead of unknown the program would > report it as an invalid option. > > But that will break scripts like mad... :( Since POSIX doesn't document -p or -i, they are already non-portable options. But you do have a point that just deleting the options may have far-reaching effects... -- Eric Blake From MAILER-DAEMON Wed Sep 14 13:23:37 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFayu-0001bn-QR for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:23:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFZu5-0000HG-4c for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFZu2-0000Fs-I3 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFZu2-0000Fn-Ao for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:14:30 -0400 Received: from [152.66.242.225] (helo=sziami.cs.bme.hu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFZsY-00056A-DJ for bug-coreutils@gnu.org; Wed, 14 Sep 2005 12:12:58 -0400 Received: from localhost (localhost [127.0.0.1]) by sziami.cs.bme.hu (Postfix) with ESMTP id 5C19A372EA for ; Wed, 14 Sep 2005 18:12:55 +0200 (CEST) Received: from sziami.cs.bme.hu ([127.0.0.1]) by localhost (sziami [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11414-08 for ; Wed, 14 Sep 2005 18:12:51 +0200 (CEST) Received: by sziami.cs.bme.hu (Postfix, from userid 1022) id 520B736F19; Wed, 14 Sep 2005 18:12:51 +0200 (CEST) Date: Wed, 14 Sep 2005 18:12:51 +0200 From: Egmont Koblinger To: bug-coreutils@gnu.org Message-ID: <20050914161251.GA11401@cs.bme.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline User-Agent: Mutt/1.5.6+20040722i X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at cs.bme.hu Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Wed, 14 Sep 2005 13:23:01 -0400 Subject: tr doesn't support multibyte characters X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 16:14:34 -0000 Hi, tr (from coreutils 5.2.1, but I saw no changelog entry corresponding to t= his in 5.3.0) doesn't support UTF-8 encoding. This is an excerpt from a termi= nal set to UTF-8 mode and LANG=3Dhu_HU.UTF-8 (no LC_* variable); $ echo =E1 | tr =E1 a aa $ echo a | tr a =E1 $=20 I guess tr should support multibyte character sets, even if not by defaul= t, then by providing a command line option. If I'm wrong and the current behavior is the desired one then please repl= ace all occurances of "character" to "byte" in its manual. Thanks, Egmont From MAILER-DAEMON Wed Sep 14 13:36:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFbBM-00042p-W4 for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:36:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFaxq-0001PY-Jc for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:22:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFaxm-0001OR-8P for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:22:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFaxm-0001O3-4Q for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:22:26 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFax0-0002KI-88 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:21:38 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 72A594B2E8 for ; Wed, 14 Sep 2005 11:21:37 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 67CAA1565D2; Wed, 14 Sep 2005 11:21:37 -0600 (MDT) Date: Wed, 14 Sep 2005 11:21:37 -0600 To: bug-coreutils@gnu.org Message-ID: <20050914172137.GA32320@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1126714316.287418.20552.nullmailer@Update.UU.SE> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 17:36:28 -0000 Alfred M. Szmidt wrote: > > I have often thought it would be better if on machines that could > > not reasonably support those extra uname options that the options > > be disabled entirely. Then instead of unknown the program would > > report it as an invalid option. > > But that will break scripts like mad... :( I don't think it will break scripts because legacy operating systems don't support those options either. Therefore most people looking at 'uname -p' output will already be broken on many platforms. And on platforms where it works it will continue to work. rwp@hpux-11.23:~$ /bin/uname -p /bin/uname: illegal option -- p usage: uname [-amnrsvil] [-S nodename] Neither does Debian. They disable the option because of the user complaints. Bob From MAILER-DAEMON Wed Sep 14 13:36:54 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFbBm-0004FQ-2i for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:36:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFbBj-0004EU-Ou for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:36:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFbBh-0004DX-Fq for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:36:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFbBg-00049C-PY for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:36:49 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFb7d-0003Ni-T9 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 13:32:38 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 186C43C2; Wed, 14 Sep 2005 19:32:36 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26652; Wed, 14 Sep 05 19:32:24 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 0EF822ED; Wed, 14 Sep 2005 19:32:23 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id B582144004; Wed, 14 Sep 2005 19:32:23 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06120-01-12; Wed, 14 Sep 2005 19:32:22 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 3345A44003; Wed, 14 Sep 2005 19:32:22 +0200 (CEST) Received: (nullmailer pid 20668 invoked by uid 30270); Wed, 14 Sep 2005 17:32:22 -0000 From: "Alfred M\. Szmidt" To: ericblake@comcast.net (Eric Blake) In-reply-to: <091420051645.3130.432853A0000CDC1400000C3A22058864420A050E040D0C079D0A@comcast.net> (ericblake@comcast.net) References: <091420051645.3130.432853A0000CDC1400000C3A22058864420A050E040D0C079D0A@comcast.net> Date: Wed, 14 Sep 2005 19:32:22 +0200 Message-Id: <1126719142.097029.20667.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 17:36:52 -0000 Since POSIX doesn't document -p or -i, they are already non-portable options. GNU Coreutils isn't POSIX Coreutils. From MAILER-DAEMON Wed Sep 14 14:18:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFbqM-0001V6-0K for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 14:18:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFbqC-0001O7-74 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 14:18:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFbq7-0001LG-EX for bug-coreutils@gnu.org; Wed, 14 Sep 2005 14:18:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFbq7-0001Ia-9u for bug-coreutils@gnu.org; Wed, 14 Sep 2005 14:18:35 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFbkp-0006K2-JU for bug-coreutils@gnu.org; Wed, 14 Sep 2005 14:13:07 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id F2B4D212; Wed, 14 Sep 2005 20:13:06 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26637; Wed, 14 Sep 05 20:12:58 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 3EB5A1A4; Wed, 14 Sep 2005 20:12:55 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id A2FD144003; Wed, 14 Sep 2005 20:12:55 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03733-03-45; Wed, 14 Sep 2005 20:12:55 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 10BCC44002; Wed, 14 Sep 2005 20:12:55 +0200 (CEST) Received: (nullmailer pid 20725 invoked by uid 30270); Wed, 14 Sep 2005 18:12:54 -0000 From: "Alfred M\. Szmidt" To: bob@proulx.com (Bob Proulx) In-reply-to: <20050914172137.GA32320@dementia.proulx.com> (bob@proulx.com) References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> Date: Wed, 14 Sep 2005 20:12:54 +0200 Message-Id: <1126721574.952896.20724.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 18:18:44 -0000 > > I have often thought it would be better if on machines that > > could not reasonably support those extra uname options that > > the options be disabled entirely. Then instead of unknown the > > program would report it as an invalid option. > > But that will break scripts like mad... :( I don't think it will break scripts because legacy operating systems don't support those options either. If you consider GNU a legacy operating system, sure. Recall, GNU coreutils is for GNU, not non-GNU systems. How about those options get disabled if POSIXLY_CORRECT is defined instead? That makes sense, and doesn't break scripts. From MAILER-DAEMON Wed Sep 14 15:32:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFczi-000350-Da for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 15:32:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFcze-00033M-EF for bug-coreutils@gnu.org; Wed, 14 Sep 2005 15:32:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFczZ-00030g-9z for bug-coreutils@gnu.org; Wed, 14 Sep 2005 15:32:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFczX-0002yb-Fr for bug-coreutils@gnu.org; Wed, 14 Sep 2005 15:32:23 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFcrG-00033X-13 for bug-coreutils@gnu.org; Wed, 14 Sep 2005 15:23:50 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 344DC4B2E8 for ; Wed, 14 Sep 2005 13:23:49 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 0A0B515665F; Wed, 14 Sep 2005 13:23:49 -0600 (MDT) Date: Wed, 14 Sep 2005 13:23:49 -0600 To: bug-coreutils@gnu.org Message-ID: <20050914192349.GA954@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1126721574.952896.20724.nullmailer@Update.UU.SE> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 19:32:31 -0000 Alfred M. Szmidt wrote: > I don't think it will break scripts because legacy operating > systems don't support those options either. ^^^^^^ > If you consider GNU a legacy operating system, sure. Recall, GNU > coreutils is for GNU, not non-GNU systems. Notice that I said "either". Does Hurd support the interface to supply 'uname -p' information? The implication from reading this is your statement is that it does not. In which case 'uname -p' on GNU Hurd is not useful either. > How about those options get disabled if POSIXLY_CORRECT is defined > instead? That makes sense, and doesn't break scripts. Can you give an example of scripts that would use 'uname -p' and why they are not already broken now? Because basically when dealing with a command as non-portable as uname you should take these differences into consideration now already. The only portable way to use uname is without any options and then work from there after you know what system you are on. Look at config.guess for lots of examples of uname issues. Basically uname is awful. Bob From MAILER-DAEMON Wed Sep 14 16:25:23 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFdoo-0007hK-VX for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 16:25:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFdnC-0006nl-Eh for bug-coreutils@gnu.org; Wed, 14 Sep 2005 16:23:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFdn7-0006jF-3E for bug-coreutils@gnu.org; Wed, 14 Sep 2005 16:23:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFdn6-0006LP-8K for bug-coreutils@gnu.org; Wed, 14 Sep 2005 16:23:36 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFdUX-0005gT-KA for bug-coreutils@gnu.org; Wed, 14 Sep 2005 16:04:25 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 1422E2F6; Wed, 14 Sep 2005 22:04:24 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26631; Wed, 14 Sep 05 22:04:15 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id DB12030C for ; Wed, 14 Sep 2005 22:04:14 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id B8AF344004 for ; Wed, 14 Sep 2005 22:04:14 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16709-01-11 for ; Wed, 14 Sep 2005 22:04:13 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 1E23E44003; Wed, 14 Sep 2005 22:04:13 +0200 (CEST) Received: (nullmailer pid 20897 invoked by uid 30270); Wed, 14 Sep 2005 20:04:13 -0000 From: "Alfred M\. Szmidt" To: bug-coreutils@gnu.org Cc: bug-coreutils@gnu.org In-reply-to: <20050914192349.GA954@dementia.proulx.com> (bob@proulx.com) References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <20050914192349.GA954@dementia.proulx.com> Date: Wed, 14 Sep 2005 22:04:13 +0200 Message-Id: <1126728253.006263.20896.nullmailer@Update.UU.SE> Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 20:25:20 -0000 > I don't think it will break scripts because legacy operating > systems don't support those options either. ^^^^^^ > If you consider GNU a legacy operating system, sure. Recall, GNU > coreutils is for GNU, not non-GNU systems. Notice that I said "either". Noted, sorry that I missed it. Does Hurd support the interface to supply 'uname -p' information? The implication from reading this is your statement is that it does not. In which case 'uname -p' on GNU Hurd is not useful either. It doesn't work currently, but there are no reasons why one couldn't add such support. Because basically when dealing with a command as non-portable as uname you should take these differences into consideration now already. They are only non-portable across different operating systems (say OpenBSD vs GNU). My point is that coreutils main goal is not to be portable across various operating systems, if `uname -p' outputs `unknown' on platforms that can't provide that info, then that is fine. Cheers. From MAILER-DAEMON Wed Sep 14 18:22:54 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFfeX-0006EL-G6 for mharc-bug-coreutils@gnu.org; Wed, 14 Sep 2005 18:22:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFfeW-0006Dn-8T for bug-coreutils@gnu.org; Wed, 14 Sep 2005 18:22:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFfeK-0006AF-2V for bug-coreutils@gnu.org; Wed, 14 Sep 2005 18:22:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFfeJ-000699-VE for bug-coreutils@gnu.org; Wed, 14 Sep 2005 18:22:40 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFfeE-0006mT-FB for bug-coreutils@gnu.org; Wed, 14 Sep 2005 18:22:35 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8EMLs426477; Wed, 14 Sep 2005 15:21:54 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFfda-00052L-Hh; Wed, 14 Sep 2005 15:21:54 -0700 To: Egmont Koblinger References: <20050914161251.GA11401@cs.bme.hu> From: Paul Eggert Date: Wed, 14 Sep 2005 15:21:54 -0700 In-Reply-To: <20050914161251.GA11401@cs.bme.hu> (Egmont Koblinger's message of "Wed, 14 Sep 2005 18:12:51 +0200") Message-ID: <87ll1zp9x9.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tr doesn't support multibyte characters X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2005 22:22:52 -0000 Egmont Koblinger writes: > I guess tr should support multibyte character sets, even if not by default, > then by providing a command line option. That'd be nice. It's a bit tricky, though. Doing it right would require that tr support encoding errors (stray byte sequences that cannot be parsed as parts of multibyte characters). For example, one should easily be able to remove the encoding errors without making any other changes, or to transliterate to upper-case while preserving encoding errors. Help in this area would be appreciated. The POSIX spec for tr talks about this issue somewhat, but it's incoherent -- I can't make heads or tails of what the -C option is really supposed to do. > If I'm wrong and the current behavior is the desired one then please replace > all occurances of "character" to "byte" in its manual. The CVS version of the coreutils manual talks about this, saying "Currently @command{tr} fully supports only single-byte characters. Eventually it will support multibyte characters; ..." with some more details about the problem. From MAILER-DAEMON Thu Sep 15 02:02:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFmox-0007qJ-3S for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 02:02:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFmot-0007oM-Dp for bug-coreutils@gnu.org; Thu, 15 Sep 2005 02:02:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFmor-0007nU-Tk for bug-coreutils@gnu.org; Thu, 15 Sep 2005 02:02:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFmoe-00075X-Lw for bug-coreutils@gnu.org; Thu, 15 Sep 2005 02:01:48 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFmSm-00024f-Gi for bug-coreutils@gnu.org; Thu, 15 Sep 2005 01:39:12 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 794584B52C for ; Wed, 14 Sep 2005 23:39:09 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 6547B15686D; Wed, 14 Sep 2005 23:39:09 -0600 (MDT) Date: Wed, 14 Sep 2005 23:39:09 -0600 To: bug-coreutils@gnu.org Message-ID: <20050915053909.GD7017@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <20050914192349.GA954@dementia.proulx.com> <1126728253.006263.20896.nullmailer@Update.UU.SE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1126728253.006263.20896.nullmailer@Update.UU.SE> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 06:02:04 -0000 Alfred M. Szmidt wrote: > They are only non-portable across different operating systems (say > OpenBSD vs GNU). My point is that coreutils main goal is not to be > portable across various operating systems, if `uname -p' outputs > `unknown' on platforms that can't provide that info, then that is > fine. If Hurd implements the interface to enable 'uname -p' then that would certainly be a good thing in general. A win-win. But if it does not then already at this time 'uname -p' is not really useful to there. If you are not concerned about portability across systems and are only concerned about GNU Hurd then it would seem that whether an option is available or not on another system should not be a concern. On the other hand I am concerned with portability across different systems. And even in the case that I were using it semi-badly I think this would not be serious breakage. case $(uname -z) in # intentionally using bad -z option here foo) echo foo ;; bar) echo bar ;; *) echo unknown uname output handler ;; esac In that case: uname: invalid option -- z Try `uname --help' for more information. unknown uname output handler That does not seem so bad. A little noise to prod the author that the option is not supported and should be handled more appropriately to be portable to different systems. In a more than semi-bad case: case $(uname -z) in # intentionally using bad -z option here foo) echo foo ;; bar) echo bar ;; unknown) echo unknown uname output handler ;; esac That would break as shown here. uname: invalid option -- z Try `uname --help' for more information. But I think it is bad to code in the unknown case here as in this example. Probably not going to be really fatal. But already a problem today for me to program across systems because already most systems I work with do not implement -p. I would need something like this: case $(uname -p 2>/dev/null) in sparc) echo sparc ;; *) echo unknown uname output handler ;; esac That should work fine. At least as well as it does today. In any case, my goal with my suggestion was only that if something is not going to be functional and will only serve to intice a lot of bug reports from users reporting that it is not functional then I think it is better not to provide it at all and avoid the complaints. Bob From MAILER-DAEMON Thu Sep 15 04:07:28 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFomE-0000oF-3J for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 04:07:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFom7-0000ni-6x for bug-coreutils@gnu.org; Thu, 15 Sep 2005 04:07:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFom4-0000nE-4Q for bug-coreutils@gnu.org; Thu, 15 Sep 2005 04:07:17 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFojZ-0000Ch-Ec for bug-coreutils@gnu.org; Thu, 15 Sep 2005 04:04:42 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFoYB-0002Ba-AG for bug-coreutils@gnu.org; Thu, 15 Sep 2005 03:52:55 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id 4DAEB620; Thu, 15 Sep 2005 09:52:53 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14344; Thu, 15 Sep 05 09:52:44 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id 505833E0 for ; Thu, 15 Sep 2005 09:52:44 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 320C644004 for ; Thu, 15 Sep 2005 09:52:44 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29302-02-2 for ; Thu, 15 Sep 2005 09:52:43 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 9026744003; Thu, 15 Sep 2005 09:52:43 +0200 (CEST) Received: (nullmailer pid 22020 invoked by uid 30270); Thu, 15 Sep 2005 07:52:43 -0000 From: "Alfred M\. Szmidt" To: bug-coreutils@gnu.org Cc: bug-coreutils@gnu.org In-reply-to: <20050915053909.GD7017@dementia.proulx.com> (bob@proulx.com) References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <20050914192349.GA954@dementia.proulx.com> <1126728253.006263.20896.nullmailer@Update.UU.SE> <20050915053909.GD7017@dementia.proulx.com> Date: Thu, 15 Sep 2005 09:52:43 +0200 Message-Id: <1126770763.377000.22019.nullmailer@Update.UU.SE> Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 08:07:22 -0000 If Hurd implements the interface to enable 'uname -p' then that would certainly be a good thing in general. A win-win. But if it does not then already at this time 'uname -p' is not really useful to there. But that isn't a good reason to make the option produce a error. If you are not concerned about portability across systems and are only concerned about GNU Hurd then it would seem that whether an option is available or not on another system should not be a concern. I'm concerned about both. If a option works in GNU uname on GNU then that same option should work (i.e. not report an error) on non-GNU platforms. --author in ls doesn't work (it shows the group, not st_author) on GNU/Linux for example, or any of the BSDs, but it would just be crazy to make it produce an error on those platforms. On the other hand I am concerned with portability across different systems. And even in the case that I were using it semi-badly I think this would not be serious breakage. If that is the case, why not just make `uname -p' (and for any other non-POSIX options) produce an error if POSIXLY_CORRECT is defined? From MAILER-DAEMON Thu Sep 15 15:03:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFyxV-0008S1-Qs for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 14:59:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFyxM-0008MR-Hl for bug-coreutils@gnu.org; Thu, 15 Sep 2005 14:59:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFyx7-0008D0-S0 for bug-coreutils@gnu.org; Thu, 15 Sep 2005 14:59:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFyx5-00086u-7u for bug-coreutils@gnu.org; Thu, 15 Sep 2005 14:59:19 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFyqy-0000dD-Ew for bug-coreutils@gnu.org; Thu, 15 Sep 2005 14:53:00 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8FIqt404389; Thu, 15 Sep 2005 11:52:55 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFyqt-0002nA-Ew; Thu, 15 Sep 2005 11:52:55 -0700 To: Jim Meyering References: <20050721185224.GA55824@lizzy.catnook.local> <87u0impzv1.fsf@penguin.cs.ucla.edu> <85wtnhrj17.fsf@pi.meyering.net> <87y860y5p5.fsf@penguin.cs.ucla.edu> <87slw8j6uv.fsf@rho.meyering.net> From: Paul Eggert Date: Thu, 15 Sep 2005 11:52:55 -0700 In-Reply-To: <87slw8j6uv.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 14 Sep 2005 12:12:24 +0200") Message-ID: <87ll1yyxh4.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jos@catnook.com, bug-coreutils@gnu.org Subject: Re: date not parsing full iso-8601 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 18:59:43 -0000 Jim Meyering writes: > BTW, I don't like the fact that the new %:z formats zero-fill by default, > when used with a wider field width, but I've left it as-is, for now. Hmm, RFC 3339 requires the leading zero in "+07:00". Some people like "+7" and they can have that by specifying a smaller width. I agree that "+007" would be overkill (no pun intended), but my impression is that the code won't easily generate both "+07" and " +07". > * strftime.c (my_strftime): Parse the colons of %:::z *after* the > optional field width, not before, so we accept %9:z, not %:9z. Thanks for catching that. I tuned the patch slightly by installing this further patch. 2005-09-15 Paul Eggert * strftime.c (my_strftime): Rewrite the previous change slightly, to make it a bit faster and (I hope) clearer. --- strftime.c 14 Sep 2005 16:10:38 -0000 1.91 +++ strftime.c 15 Sep 2005 18:47:56 -0000 1.92 @@ -492,7 +492,7 @@ my_strftime (CHAR_T *s, size_t maxsize, int width = -1; bool to_lowcase = false; bool to_uppcase = false; - size_t colons = 0; + size_t colons; bool change_case = false; int format_char; @@ -643,19 +643,6 @@ my_strftime (CHAR_T *s, size_t maxsize, break; } - /* Parse the colons of %:::z *after* the optional field width, - not before, so we accept %9:z, not %:9z. */ - { - const CHAR_T *q; - for (q = f; *q == L_(':') && q - f < 3; q++) - ; /* empty */ - if (*q == L_('z')) - { - colons = q - f; - f = q; - } - } - /* Now do the specified format. */ format_char = *f; switch (format_char) @@ -1320,7 +1307,20 @@ my_strftime (CHAR_T *s, size_t maxsize, #endif break; + case L_(':'): + /* :, ::, and ::: are valid only just before 'z'. + :::: etc. are rejected later. */ + for (colons = 1; f[colons] == L_(':'); colons++) + continue; + if (f[colons] != L_('z')) + goto bad_format; + f += colons; + goto do_z_conversion; + case L_('z'): + colons = 0; + + do_z_conversion: if (tp->tm_isdst < 0) break; From MAILER-DAEMON Thu Sep 15 16:06:20 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EFzzw-0007xj-MV for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:06:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFzzv-0007xY-2Z for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:06:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFzzu-0007xG-9c for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:06:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFzzB-0007aE-M5 for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:05:33 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFzz9-0006Z2-WF; Thu, 15 Sep 2005 16:05:32 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8FK5T410677; Thu, 15 Sep 2005 13:05:29 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EFzz7-0006QK-D5; Thu, 15 Sep 2005 13:05:29 -0700 To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> From: Paul Eggert Date: Thu, 15 Sep 2005 13:05:29 -0700 In-Reply-To: <1126721574.952896.20724.nullmailer@Update.UU.SE> (Alfred M. Szmidt's message of "Wed, 14 Sep 2005 20:12:54 +0200") Message-ID: <87br2uyu46.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: 193702@bugs.debian.org, Bob Proulx , 193170@bugs.debian.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 20:06:19 -0000 While looking into this problem I noticed that Debian tried to disable uname -p and -i, but they didn't do it quite right. For example: $ /bin/uname -x /bin/uname: invalid option -- x Try `/bin/uname --help' for more information. $ /bin/uname -p Try `/bin/uname --help' for more information. I checked the Debian bug database, and found that this is bug 193170 (see the mail from Kalle Olavi Niemitalo dated 2005-04-30). I'll CC: this message to Debian, since I just installed a patch to fix this bug along with everything else (please see below). "Alfred M\. Szmidt" writes: > How about those [uname -p and -i] options get disabled if > POSIXLY_CORRECT is defined instead? I'd rather not do that, since we want to minimize the effects of POSIXLY_CORRECT. POSIX does not require that these options be disabled (or enabled, for that matter), so POSIXLY_CORRECT should not affect uname's behavior when presented with those options. I think you and Bob Proulx are both right, to some extent. GNU/Linux users have rebelled against having "uname -a" output "unknown" all the time, so we should fix this. However, it's certainly OK if "uname -p" outputs "unknown". Bob Proulx's idea of reporting -p and -i as invalid options if the values are unknown would be a bit tricky, since in general we don't know they're invalid unless we try to get the values. So, instead, I propose that uname -a not output the -i and -p information if it is unavailable. That'll make uname -a output harder to parse, but it's already impossible to parse portably anyway, so it's no big deal. It does address the issue that Debian rebelled over. And it won't break any scripts in practice (unless they're unportable or broken anyway). I installed the following patch to implement this. Comments are welcome. I wish the problem would go away, but it won't.... 2005-09-15 Paul Eggert * NEWS: uname -a no longer generates the -p and -i outputs if they are unknown. * doc/coreutils.texi (uname invocation): Document this. * src/uname.c (usage): Document this. (main): Implement this. Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.310 diff -p -u -r1.310 NEWS --- NEWS 14 Sep 2005 06:57:35 -0000 1.310 +++ NEWS 15 Sep 2005 19:55:38 -0000 @@ -210,6 +210,8 @@ GNU coreutils NEWS stat -f's default output format has been changed to output this size as well. stat -f recognizes file systems of type XFS and JFS + uname -a no longer generates the -p and -i outputs if they are unknown. + * Major changes in release 5.3.0 (2005-01-08) [unstable] ** Bug fixes Index: doc/coreutils.texi =================================================================== RCS file: /fetish/cu/doc/coreutils.texi,v retrieving revision 1.282 diff -p -u -r1.282 coreutils.texi --- doc/coreutils.texi 13 Sep 2005 23:01:59 -0000 1.282 +++ doc/coreutils.texi 15 Sep 2005 19:55:41 -0000 @@ -12214,7 +12214,8 @@ The program accepts the following option @itemx --all @opindex -a @opindex --all -Print all of the below information. +Print all of the below information, except omit the processor type +and the hardware platform name if they are unknown. @item -i @itemx --hardware-platform Index: src/uname.c =================================================================== RCS file: /fetish/cu/src/uname.c,v retrieving revision 1.66 diff -p -u -r1.66 uname.c --- src/uname.c 14 May 2005 07:58:37 -0000 1.66 +++ src/uname.c 15 Sep 2005 19:55:41 -0000 @@ -118,7 +118,8 @@ usage (int status) fputs (_("\ Print certain system information. With no OPTION, same as -s.\n\ \n\ - -a, --all print all information, in the following order:\n\ + -a, --all print all information, in the following order,\n\ + except omit -p and -i if unknown:\n\ -s, --kernel-name print the kernel name\n\ -n, --nodename print the network node hostname\n\ -r, --kernel-release print the kernel release\n\ @@ -126,8 +127,8 @@ Print certain system information. With fputs (_("\ -v, --kernel-version print the kernel version\n\ -m, --machine print the machine hardware name\n\ - -p, --processor print the processor type\n\ - -i, --hardware-platform print the hardware platform\n\ + -p, --processor print the processor type or \"unknown\"\n\ + -i, --hardware-platform print the hardware platform or \"unknown\"\n\ -o, --operating-system print the operating system\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -172,7 +173,7 @@ main (int argc, char **argv) switch (c) { case 'a': - toprint = -1; + toprint = UINT_MAX; break; case 's': @@ -286,7 +287,8 @@ main (int argc, char **argv) # endif } #endif - print_element (element); + if (! (toprint == UINT_MAX && element == unknown)) + print_element (element); } if (toprint & PRINT_HARDWARE_PLATFORM) @@ -310,7 +312,8 @@ main (int argc, char **argv) element = hardware_platform; } #endif - print_element (element); + if (! (toprint == UINT_MAX && element == unknown)) + print_element (element); } if (toprint & PRINT_OPERATING_SYSTEM) From MAILER-DAEMON Thu Sep 15 16:31:34 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EG0OL-0000GW-7N for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:31:33 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EG0O9-00009D-AV for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:31:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EG0O4-000068-En for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:31:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EG0O2-0008SO-VN for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:31:14 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EG0It-0008Q5-Qs for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:25:56 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id ECF2635F; Thu, 15 Sep 2005 22:25:54 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14375; Thu, 15 Sep 05 22:25:39 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id E7FE535F; Thu, 15 Sep 2005 22:25:38 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id C110044004; Thu, 15 Sep 2005 22:25:38 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21703-02-10; Thu, 15 Sep 2005 22:25:37 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id CBA3C44003; Thu, 15 Sep 2005 22:25:37 +0200 (CEST) Received: (nullmailer pid 23117 invoked by uid 30270); Thu, 15 Sep 2005 20:25:37 -0000 From: "Alfred M\. Szmidt" To: Paul Eggert In-reply-to: <87br2uyu46.fsf@penguin.cs.ucla.edu> (message from Paul Eggert on Thu, 15 Sep 2005 13:05:29 -0700) References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <87br2uyu46.fsf@penguin.cs.ucla.edu> Date: Thu, 15 Sep 2005 22:25:37 +0200 Message-Id: <1126815937.689277.23116.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org, 193702@bugs.debian.org, bob@proulx.com, 193170@bugs.debian.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 20:31:25 -0000 I like the fix. Though, changing the behaviour of `uname -a' just cause some people have rebelled against it outputing `unknown' in some places is quite silly; why not add such support to Linux and have it output something useful! Thanks Paul. From MAILER-DAEMON Thu Sep 15 17:16:05 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EG15Q-0004qx-Rf for mharc-bug-coreutils@gnu.org; Thu, 15 Sep 2005 17:16:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EG15P-0004qk-Hk for bug-coreutils@gnu.org; Thu, 15 Sep 2005 17:16:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EG15O-0004qW-4B for bug-coreutils@gnu.org; Thu, 15 Sep 2005 17:16:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EG0z0-0002vv-AX for bug-coreutils@gnu.org; Thu, 15 Sep 2005 17:09:26 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EG0Tm-0001LS-B4 for bug-coreutils@gnu.org; Thu, 15 Sep 2005 16:37:10 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id E19E6E8E; Thu, 15 Sep 2005 22:37:08 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87br2uyu46.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Thu, 15 Sep 2005 13:05:29 -0700") References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <87br2uyu46.fsf@penguin.cs.ucla.edu> Date: Thu, 15 Sep 2005 22:37:08 +0200 Message-ID: <87u0gm130r.fsf@rho.meyering.net> Lines: 11 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 21:16:03 -0000 Paul Eggert wrote: > 2005-09-15 Paul Eggert > > * NEWS: uname -a no longer generates the -p and -i outputs if they > are unknown. > * doc/coreutils.texi (uname invocation): Document this. > * src/uname.c (usage): Document this. > (main): Implement this. I like it. Thanks for doing that. From MAILER-DAEMON Fri Sep 16 00:34:37 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EG7vp-0005sQ-2L for mharc-bug-coreutils@gnu.org; Fri, 16 Sep 2005 00:34:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EG7un-0005Td-BO for bug-coreutils@gnu.org; Fri, 16 Sep 2005 00:33:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EG7ue-0005II-QO for bug-coreutils@gnu.org; Fri, 16 Sep 2005 00:33:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EG7uX-0005E5-7o for bug-coreutils@gnu.org; Fri, 16 Sep 2005 00:33:17 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EG7mA-0005TA-Ku for bug-coreutils@gnu.org; Fri, 16 Sep 2005 00:24:38 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id CD7174B2E8 for ; Thu, 15 Sep 2005 22:24:37 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id B28DB156F28; Thu, 15 Sep 2005 22:24:37 -0600 (MDT) Date: Thu, 15 Sep 2005 22:24:37 -0600 To: bug-coreutils@gnu.org Message-ID: <20050916042437.GA24691@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87fys8y3jb.fsf@penguin.cs.ucla.edu> <43279388.3000002@byu.net> <87slw8w21k.fsf@penguin.cs.ucla.edu> <20050914155942.GA23350@dementia.proulx.com> <1126714316.287418.20552.nullmailer@Update.UU.SE> <20050914172137.GA32320@dementia.proulx.com> <1126721574.952896.20724.nullmailer@Update.UU.SE> <87br2uyu46.fsf@penguin.cs.ucla.edu> <87u0gm130r.fsf@rho.meyering.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87u0gm130r.fsf@rho.meyering.net> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: Possible bug in uname command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 04:34:22 -0000 Jim Meyering wrote: > Paul Eggert wrote: > > 2005-09-15 Paul Eggert > > > > * NEWS: uname -a no longer generates the -p and -i outputs if they > > are unknown. > > * doc/coreutils.texi (uname invocation): Document this. > > * src/uname.c (usage): Document this. > > (main): Implement this. > > I like it. > Thanks for doing that. Very good. I like it too. Thanks Bob From MAILER-DAEMON Fri Sep 16 04:12:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGBL5-0000Fk-V9 for mharc-bug-coreutils@gnu.org; Fri, 16 Sep 2005 04:12:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGBKw-0000DG-VR for bug-coreutils@gnu.org; Fri, 16 Sep 2005 04:12:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGBKm-0000Ay-Ia for bug-coreutils@gnu.org; Fri, 16 Sep 2005 04:12:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGBBt-0007QY-Rt for bug-coreutils@gnu.org; Fri, 16 Sep 2005 04:03:26 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGBAd-0002q0-Uz for bug-coreutils@gnu.org; Fri, 16 Sep 2005 04:02:08 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8G827421004 for ; Fri, 16 Sep 2005 01:02:07 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EGBAc-0001bv-Vq for bug-coreutils@gnu.org; Fri, 16 Sep 2005 01:02:06 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 16 Sep 2005 01:02:06 -0700 Message-ID: <871x3pqw3l.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: imported sub-second file time stamp improvements from tar via gnulib X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 08:12:48 -0000 I installed this into coreutils, to get some improved support for sub-second file time stamps on platforms like OpenBSD. 2005-09-16 Paul Eggert * src/copy.c: Include stat-time.h. (copy_internal): Use its functions instead of the obsolete TIMESPEC_NS macro. * src/cp.c (re_protect): Likewise. * src/date.c (main): Likewise. * src/du.c (struct duinfo, duinfo_init, duinfo_set, duinfo_add): (show_date, print_size, process_file): Likewise. * src/install.c (change_timestamps): Likewise. * src/ls.c (cmp_ctime, cmp_mtime, cmp_atime, print_long_format): Likewise. * src/pr.c (init_header): Likewise. * src/stat.c (human_time, print_stat): Likewise. * src/tail.c (record_open_fd, tail_forever): Likewise. * src/test.c (get_mtime, binary_operator): Likewise. * src/touch.c (touch, main): Likewise. * src/test.c (get_mtime): Renamed from age_of. All uses changed. * m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Do not require AC_STRUCT_ST_MTIM_NSEC; it's obsolete. * m4/prereq.m4 (gl_PREREQ): Require gl_STAT_TIME. * lib/.cppi-disable: Add stat-time.h. Import from gnulib. Import from gnulib. * lib/stat-time.h: New file. * lib/timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP, CTIME_CMP): (MTIME_CMP, TIMESPEC_NS): Remove. Now done by stat-time.h, in a different way. (timespec_cmp): New function. * lib/utimecmp.c: Include stat-time.h. (SYSCALL_RESOLUTION): Depend on whether various struct stat members exist, not on the obsolescent ST_MTIM_NSEC. (utimecmp): Use the new stat-time functions rater than TIMESPEC_NS. * m4/st_mtim.m4: Remove. Superseded by... * m4/stat-time.m4: New file. * m4/timespec.m4 (gl_TIMESPEC): Require AC_C_INLINE. Do not invoke AC_STRUCT_ST_MTIM_NSEC; no longer needed. Index: lib/timespec.h =================================================================== RCS file: /fetish/cu/lib/timespec.h,v retrieving revision 1.5 diff -p -u -r1.5 timespec.h --- lib/timespec.h 14 May 2005 07:58:07 -0000 1.5 +++ lib/timespec.h 16 Sep 2005 07:20:30 -0000 @@ -42,22 +42,15 @@ struct timespec }; # endif -# ifdef ST_MTIM_NSEC -# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns) -# else -# define ST_TIME_CMP_NS(a, b, ns) 0 -# endif -# define ST_TIME_CMP(a, b, s, ns) \ - ((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns)) -# define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC) -# define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC) -# define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC) - -# ifdef ST_MTIM_NSEC -# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) -# else -# define TIMESPEC_NS(timespec) 0 -# endif +/* Return negative, zero, positive if A < B, A == B, A > B, respectively. + Assume the nanosecond components are in range, or close to it. */ +static inline int +timespec_cmp (struct timespec a, struct timespec b) +{ + return (a.tv_sec < b.tv_sec ? -1 + : a.tv_sec > b.tv_sec ? 1 + : a.tv_nsec - b.tv_nsec); +} # if ! HAVE_DECL_NANOSLEEP /* Don't specify a prototype here. Some systems (e.g., OSF) declare Index: lib/utimecmp.c =================================================================== RCS file: /fetish/cu/lib/utimecmp.c,v retrieving revision 1.3 diff -p -u -r1.3 utimecmp.c --- lib/utimecmp.c 14 May 2005 07:58:07 -0000 1.3 +++ lib/utimecmp.c 16 Sep 2005 07:20:30 -0000 @@ -36,6 +36,7 @@ #include #include "hash.h" #include "intprops.h" +#include "stat-time.h" #include "timespec.h" #include "utimens.h" #include "xalloc.h" @@ -56,7 +57,12 @@ enum { BILLION = 1000 * 1000 * 1000 }; /* Best possible resolution that utimens can set and stat can return, due to system-call limitations. It must be a power of 10 that is no greater than 1 billion. */ -#if HAVE_WORKING_UTIMES && defined ST_MTIM_NSEC +#if (HAVE_WORKING_UTIMES \ + && (defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_ATIMENSEC \ + || defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_SPARE1)) enum { SYSCALL_RESOLUTION = 1000 }; #else enum { SYSCALL_RESOLUTION = BILLION }; @@ -139,8 +145,8 @@ utimecmp (char const *dst_name, /* Destination and source time stamps. */ time_t dst_s = dst_stat->st_mtime; time_t src_s = src_stat->st_mtime; - int dst_ns = TIMESPEC_NS (dst_stat->st_mtim); - int src_ns = TIMESPEC_NS (src_stat->st_mtim); + int dst_ns = get_stat_mtime_ns (dst_stat); + int src_ns = get_stat_mtime_ns (src_stat); if (options & UTIMECMP_TRUNCATE_SOURCE) { @@ -186,8 +192,8 @@ utimecmp (char const *dst_name, time_t dst_a_s = dst_stat->st_atime; time_t dst_c_s = dst_stat->st_ctime; time_t dst_m_s = dst_s; - int dst_a_ns = TIMESPEC_NS (dst_stat->st_atim); - int dst_c_ns = TIMESPEC_NS (dst_stat->st_ctim); + int dst_a_ns = get_stat_atime_ns (dst_stat); + int dst_c_ns = get_stat_ctime_ns (dst_stat); int dst_m_ns = dst_ns; /* Set RES to an upper bound on the file system resolution @@ -280,7 +286,7 @@ utimecmp (char const *dst_name, if (stat_result | (dst_status.st_mtime ^ dst_m_s) - | (TIMESPEC_NS (dst_status.st_mtim) ^ dst_m_ns)) + | (get_stat_mtime_ns (&dst_status) ^ dst_m_ns)) { /* The modification time changed, or we can't tell whether it changed. Change it back as best we can. */ @@ -298,7 +304,7 @@ utimecmp (char const *dst_name, { int old_res = res; int a = (BILLION * (dst_status.st_mtime & 1) - + TIMESPEC_NS (dst_status.st_mtim)); + + get_stat_mtime_ns (&dst_status)); res = SYSCALL_RESOLUTION; Index: m4/jm-macros.m4 =================================================================== RCS file: /fetish/cu/m4/jm-macros.m4,v retrieving revision 1.227 diff -p -u -r1.227 jm-macros.m4 --- m4/jm-macros.m4 2 Aug 2005 20:48:58 -0000 1.227 +++ m4/jm-macros.m4 16 Sep 2005 07:20:30 -0000 @@ -256,7 +256,6 @@ AC_DEFUN([gl_CHECK_ALL_TYPES], ]) AC_REQUIRE([AC_STRUCT_ST_BLOCKS]) - AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC]) AC_REQUIRE([AC_STRUCT_ST_DM_MODE]) AC_REQUIRE([AC_TYPE_GETGROUPS]) Index: m4/prereq.m4 =================================================================== RCS file: /fetish/cu/m4/prereq.m4,v retrieving revision 1.118 diff -p -u -r1.118 prereq.m4 --- m4/prereq.m4 5 Jul 2005 06:30:27 -0000 1.118 +++ m4/prereq.m4 16 Sep 2005 07:20:30 -0000 @@ -133,6 +133,7 @@ AC_DEFUN([gl_PREREQ], AC_REQUIRE([gl_SETTIME]) AC_REQUIRE([gl_SHA1]) AC_REQUIRE([gl_STAT_MACROS]) + AC_REQUIRE([gl_STAT_TIME]) AC_REQUIRE([gl_STDIO_SAFER]) AC_REQUIRE([gl_STDLIB_SAFER]) AC_REQUIRE([gl_STRCASE]) Index: m4/timespec.m4 =================================================================== RCS file: /fetish/cu/m4/timespec.m4,v retrieving revision 1.10 diff -p -u -r1.10 timespec.m4 --- m4/timespec.m4 29 Jan 2005 00:16:39 -0000 1.10 +++ m4/timespec.m4 16 Sep 2005 07:20:30 -0000 @@ -1,4 +1,4 @@ -#serial 10 +#serial 11 # Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -12,10 +12,10 @@ AC_DEFUN([gl_TIMESPEC], AC_LIBSOURCES([timespec.h]) dnl Prerequisites of lib/timespec.h. + AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_HEADER_TIME]) AC_CHECK_HEADERS_ONCE(sys/time.h) gl_CHECK_TYPE_STRUCT_TIMESPEC - AC_STRUCT_ST_MTIM_NSEC dnl Persuade glibc to declare nanosleep(). AC_REQUIRE([AC_GNU_SOURCE]) Index: src/copy.c =================================================================== RCS file: /fetish/cu/src/copy.c,v retrieving revision 1.187 diff -p -u -r1.187 copy.c --- src/copy.c 11 Jul 2005 18:28:19 -0000 1.187 +++ src/copy.c 16 Sep 2005 07:21:11 -0000 @@ -45,6 +45,7 @@ #include "quote.h" #include "same.h" #include "savedir.h" +#include "stat-time.h" #include "utimecmp.h" #include "utimens.h" #include "xreadlink.h" @@ -1567,10 +1568,8 @@ copy_internal (char const *src_name, cha { struct timespec timespec[2]; - timespec[0].tv_sec = src_sb.st_atime; - timespec[0].tv_nsec = TIMESPEC_NS (src_sb.st_atim); - timespec[1].tv_sec = src_sb.st_mtime; - timespec[1].tv_nsec = TIMESPEC_NS (src_sb.st_mtim); + timespec[0] = get_stat_atime (&src_sb); + timespec[1] = get_stat_mtime (&src_sb); if (utimens (dst_name, timespec) != 0) { Index: src/cp.c =================================================================== RCS file: /fetish/cu/src/cp.c,v retrieving revision 1.214 diff -p -u -r1.214 cp.c --- src/cp.c 3 Jul 2005 16:49:23 -0000 1.214 +++ src/cp.c 16 Sep 2005 07:21:11 -0000 @@ -33,6 +33,7 @@ #include "filenamecat.h" #include "quote.h" #include "quotearg.h" +#include "stat-time.h" #include "utimens.h" #define ASSIGN_BASENAME_STRDUPA(Dest, File_name) \ @@ -304,10 +305,8 @@ re_protect (char const *const_dst_name, { struct timespec timespec[2]; - timespec[0].tv_sec = src_sb.st_atime; - timespec[0].tv_nsec = TIMESPEC_NS (src_sb.st_atim); - timespec[1].tv_sec = src_sb.st_mtime; - timespec[1].tv_nsec = TIMESPEC_NS (src_sb.st_mtim); + timespec[0] = get_stat_atime (&src_sb); + timespec[1] = get_stat_mtime (&src_sb); if (utimens (dst_name, timespec)) { Index: src/date.c =================================================================== RCS file: /fetish/cu/src/date.c,v retrieving revision 1.156 diff -p -u -r1.156 date.c --- src/date.c 13 Sep 2005 22:08:41 -0000 1.156 +++ src/date.c 16 Sep 2005 07:21:11 -0000 @@ -33,6 +33,7 @@ #include "inttostr.h" #include "posixtm.h" #include "quote.h" +#include "stat-time.h" #include "strftime.h" #include "xanstrftime.h" @@ -494,10 +495,9 @@ main (int argc, char **argv) /* (option_specified_date || set_date) */ if (reference != NULL) { - if (stat (reference, &refstats)) + if (stat (reference, &refstats) != 0) error (EXIT_FAILURE, errno, "%s", reference); - when.tv_sec = refstats.st_mtime; - when.tv_nsec = TIMESPEC_NS (refstats.st_mtim); + when = get_stat_mtime (&refstats); } else { Index: src/du.c =================================================================== RCS file: /fetish/cu/src/du.c,v retrieving revision 1.220 diff -p -u -r1.220 du.c --- src/du.c 7 Sep 2005 06:08:01 -0000 1.220 +++ src/du.c 16 Sep 2005 07:21:12 -0000 @@ -41,6 +41,7 @@ #include "quotearg.h" #include "readtokens0.h" #include "same.h" +#include "stat-time.h" #include "strftime.h" #include "xanstrftime.h" #include "xfts.h" @@ -84,10 +85,9 @@ struct duinfo /* Size of files in directory. */ uintmax_t size; - /* Latest time stamp found. If dmax == TYPE_MINIMUM (time_t) && nsec < 0, - no time stamp has been found. */ - time_t dmax; - int nsec; + /* Latest time stamp found. If tmax.tv_sec == TYPE_MINIMUM (time_t) + && tmax.tv_nsec < 0, no time stamp has been found. */ + struct timespec tmax; }; /* Initialize directory data. */ @@ -95,17 +95,16 @@ static inline void duinfo_init (struct duinfo *a) { a->size = 0; - a->dmax = TYPE_MINIMUM (time_t); - a->nsec = -1; + a->tmax.tv_sec = TYPE_MINIMUM (time_t); + a->tmax.tv_nsec = -1; } /* Set directory data. */ static inline void -duinfo_set (struct duinfo *a, uintmax_t size, time_t dmax, int nsec) +duinfo_set (struct duinfo *a, uintmax_t size, struct timespec tmax) { a->size = size; - a->dmax = dmax; - a->nsec = nsec; + a->tmax = tmax; } /* Accumulate directory data. */ @@ -113,12 +112,8 @@ static inline void duinfo_add (struct duinfo *a, struct duinfo const *b) { a->size += b->size; - if (a->dmax < b->dmax - || (a->dmax == b->dmax && a->nsec < b->nsec)) - { - a->dmax = b->dmax; - a->nsec = b->nsec; - } + if (timespec_cmp (a->tmax, b->tmax) < 0) + a->tmax = b->tmax; } /* A structure for per-directory level information. */ @@ -406,27 +401,27 @@ hash_init (void) } /* FIXME: this code is nearly identical to code in date.c */ -/* Display the date and time in WHEN/NSEC according to the format specified +/* Display the date and time in WHEN according to the format specified in TIME_FORMAT. If TIME_FORMAT is NULL, use the standard output format. Return zero if successful. */ static void -show_date (const char *format, time_t when, int nsec) +show_date (const char *format, struct timespec when) { char *out; - struct tm *tm = localtime (&when); + struct tm *tm = localtime (&when.tv_sec); if (! tm) { char buf[INT_BUFSIZE_BOUND (intmax_t)]; error (0, 0, _("time %s is out of range"), (TYPE_SIGNED (time_t) - ? imaxtostr (when, buf) - : umaxtostr (when, buf))); + ? imaxtostr (when.tv_sec, buf) + : umaxtostr (when.tv_sec, buf))); fputs (buf, stdout); return; } - out = xanstrftime (format, tm, 0, nsec); + out = xanstrftime (format, tm, 0, when.tv_nsec); fputs (out, stdout); free (out); } @@ -450,7 +445,7 @@ print_size (const struct duinfo *pdui, c if (opt_time) { putchar ('\t'); - show_date (time_format, pdui->dmax, pdui->nsec); + show_date (time_format, pdui->tmax); } printf ("\t%s%c", string, opt_nul_terminate_output ? '\0' : '\n'); fflush (stdout); @@ -539,12 +534,9 @@ process_file (FTS *fts, FTSENT *ent) (apparent_size ? sb->st_size : ST_NBLOCKS (*sb) * ST_NBLOCKSIZE), - (time_type == time_ctime ? sb->st_ctime - : time_type == time_atime ? sb->st_atime - : sb->st_mtime), - (time_type == time_ctime ? TIMESPEC_NS (sb->st_ctim) - : time_type == time_atime ? TIMESPEC_NS (sb->st_atim) - : TIMESPEC_NS (sb->st_mtim))); + (time_type == time_mtime ? get_stat_mtime (sb) + : time_type == time_atime ? get_stat_atime (sb) + : get_stat_ctime (sb))); } level = ent->fts_level; Index: src/install.c =================================================================== RCS file: /fetish/cu/src/install.c,v retrieving revision 1.186 diff -p -u -r1.186 install.c --- src/install.c 16 Jun 2005 09:15:23 -0000 1.186 +++ src/install.c 16 Sep 2005 07:21:12 -0000 @@ -35,6 +35,7 @@ #include "mkdir-p.h" #include "modechange.h" #include "quote.h" +#include "stat-time.h" #include "utimens.h" #include "xstrtol.h" @@ -536,10 +537,8 @@ change_timestamps (const char *from, con return false; } - timespec[0].tv_sec = stb.st_atime; - timespec[0].tv_nsec = TIMESPEC_NS (stb.st_atim); - timespec[1].tv_sec = stb.st_mtime; - timespec[1].tv_nsec = TIMESPEC_NS (stb.st_mtim); + timespec[0] = get_stat_atime (&stb); + timespec[1] = get_stat_mtime (&stb); if (utimens (to, timespec)) { error (0, errno, _("cannot set time stamps for %s"), quote (to)); Index: src/ls.c =================================================================== RCS file: /fetish/cu/src/ls.c,v retrieving revision 1.398 diff -p -u -r1.398 ls.c --- src/ls.c 5 Sep 2005 17:12:07 -0000 1.398 +++ src/ls.c 16 Sep 2005 07:21:12 -0000 @@ -123,6 +123,7 @@ int wcwidth (); #include "quote.h" #include "quotearg.h" #include "same.h" +#include "stat-time.h" #include "strftime.h" #include "strverscmp.h" #include "xstrtol.h" @@ -2855,7 +2856,8 @@ static inline int cmp_ctime (struct fileinfo const *a, struct fileinfo const *b, int (*cmp) (char const *, char const *)) { - int diff = CTIME_CMP (b->stat, a->stat); + int diff = timespec_cmp (get_stat_ctime (&b->stat), + get_stat_ctime (&a->stat)); return diff ? diff : cmp (a->name, b->name); } static int compare_ctime (V a, V b) { return cmp_ctime (a, b, xstrcoll); } @@ -2867,7 +2869,8 @@ static inline int cmp_mtime (struct fileinfo const *a, struct fileinfo const *b, int (*cmp) (char const *, char const *)) { - int diff = MTIME_CMP (b->stat, a->stat); + int diff = timespec_cmp (get_stat_mtime (&b->stat), + get_stat_mtime (&a->stat)); return diff ? diff : cmp (a->name, b->name); } static int compare_mtime (V a, V b) { return cmp_mtime (a, b, xstrcoll); } @@ -2879,7 +2882,8 @@ static inline int cmp_atime (struct fileinfo const *a, struct fileinfo const *b, int (*cmp) (char const *, char const *)) { - int diff = ATIME_CMP (b->stat, a->stat); + int diff = timespec_cmp (get_stat_atime (&b->stat), + get_stat_atime (&a->stat)); return diff ? diff : cmp (a->name, b->name); } static int compare_atime (V a, V b) { return cmp_atime (a, b, xstrcoll); } @@ -3231,7 +3235,8 @@ print_long_format (const struct fileinfo size_t s; char *p; time_t when; - int when_ns IF_LINT (= 0); + int when_ns; + struct timespec when_timespec; struct tm *when_local; /* Compute mode string. On most systems, it's based on st_mode. @@ -3245,19 +3250,19 @@ print_long_format (const struct fileinfo switch (time_type) { case time_ctime: - when = f->stat.st_ctime; - when_ns = TIMESPEC_NS (f->stat.st_ctim); + when_timespec = get_stat_ctime (&f->stat); break; case time_mtime: - when = f->stat.st_mtime; - when_ns = TIMESPEC_NS (f->stat.st_mtim); + when_timespec = get_stat_mtime (&f->stat); break; case time_atime: - when = f->stat.st_atime; - when_ns = TIMESPEC_NS (f->stat.st_atim); + when_timespec = get_stat_atime (&f->stat); break; } + when = when_timespec.tv_sec; + when_ns = when_timespec.tv_nsec; + p = buf; if (print_inode) @@ -3337,7 +3342,7 @@ print_long_format (const struct fileinfo p[-1] = ' '; } - when_local = localtime (&when); + when_local = localtime (&when_timespec.tv_sec); s = 0; *p = '\1'; Index: src/pr.c =================================================================== RCS file: /fetish/cu/src/pr.c,v retrieving revision 1.156 diff -p -u -r1.156 pr.c --- src/pr.c 12 Aug 2005 07:29:51 -0000 1.156 +++ src/pr.c 16 Sep 2005 07:21:12 -0000 @@ -319,6 +319,7 @@ #include "inttostr.h" #include "mbswidth.h" #include "quote.h" +#include "stat-time.h" #include "stdio--.h" #include "strftime.h" #include "xstrtol.h" @@ -1656,7 +1657,7 @@ init_header (char *filename, int desc) { char *buf = NULL; struct stat st; - time_t s; + struct timespec t; int ns; struct tm *tm; @@ -1664,25 +1665,22 @@ init_header (char *filename, int desc) if (STREQ (filename, "-")) desc = -1; if (0 <= desc && fstat (desc, &st) == 0) - { - s = st.st_mtime; - ns = TIMESPEC_NS (st.st_mtim); - } + t = get_stat_mtime (&st); else { static struct timespec timespec; if (! timespec.tv_sec) gettime (×pec); - s = timespec.tv_sec; - ns = timespec.tv_nsec; + t = timespec; } - tm = localtime (&s); + ns = t.tv_nsec; + tm = localtime (&t.tv_sec); if (tm == NULL) { buf = xmalloc (INT_BUFSIZE_BOUND (long int) + MAX (10, INT_BUFSIZE_BOUND (int))); - sprintf (buf, "%ld.%09d", (long int) s, ns); + sprintf (buf, "%ld.%09d", (long int) t.tv_sec, ns); } else { Index: src/stat.c =================================================================== RCS file: /fetish/cu/src/stat.c,v retrieving revision 1.87 diff -p -u -r1.87 stat.c --- src/stat.c 14 May 2005 07:58:37 -0000 1.87 +++ src/stat.c 16 Sep 2005 07:21:12 -0000 @@ -52,6 +52,7 @@ #include "inttostr.h" #include "quote.h" #include "quotearg.h" +#include "stat-time.h" #include "strftime.h" #include "xreadlink.h" @@ -280,18 +281,18 @@ human_access (struct stat const *statbuf } static char * -human_time (time_t t, int t_ns) +human_time (struct timespec t) { static char str[MAX (INT_BUFSIZE_BOUND (intmax_t), (INT_STRLEN_BOUND (int) /* YYYY */ + 1 /* because YYYY might equal INT_MAX + 1900 */ + sizeof "-MM-DD HH:MM:SS.NNNNNNNNN +ZZZZ"))]; - struct tm const *tm = localtime (&t); + struct tm const *tm = localtime (&t.tv_sec); if (tm == NULL) return (TYPE_SIGNED (time_t) - ? imaxtostr (t, str) - : umaxtostr (t, str)); - nstrftime (str, sizeof str, "%Y-%m-%d %H:%M:%S.%N %z", tm, 0, t_ns); + ? imaxtostr (t.tv_sec, str) + : umaxtostr (t.tv_sec, str)); + nstrftime (str, sizeof str, "%Y-%m-%d %H:%M:%S.%N %z", tm, 0, t.tv_nsec); return str; } @@ -506,8 +507,7 @@ print_stat (char *pformat, size_t buf_le break; case 'x': xstrcat (pformat, buf_len, "s"); - printf (pformat, human_time (statbuf->st_atime, - TIMESPEC_NS (statbuf->st_atim))); + printf (pformat, human_time (get_stat_atime (statbuf))); break; case 'X': xstrcat (pformat, buf_len, TYPE_SIGNED (time_t) ? "ld" : "lu"); @@ -515,8 +515,7 @@ print_stat (char *pformat, size_t buf_le break; case 'y': xstrcat (pformat, buf_len, "s"); - printf (pformat, human_time (statbuf->st_mtime, - TIMESPEC_NS (statbuf->st_mtim))); + printf (pformat, human_time (get_stat_mtime (statbuf))); break; case 'Y': xstrcat (pformat, buf_len, TYPE_SIGNED (time_t) ? "ld" : "lu"); @@ -524,8 +523,7 @@ print_stat (char *pformat, size_t buf_le break; case 'z': xstrcat (pformat, buf_len, "s"); - printf (pformat, human_time (statbuf->st_ctime, - TIMESPEC_NS (statbuf->st_ctim))); + printf (pformat, human_time (get_stat_ctime (statbuf))); break; case 'Z': xstrcat (pformat, buf_len, TYPE_SIGNED (time_t) ? "ld" : "lu"); Index: src/tail.c =================================================================== RCS file: /fetish/cu/src/tail.c,v retrieving revision 1.241 diff -p -u -r1.241 tail.c --- src/tail.c 22 Aug 2005 10:31:17 -0000 1.241 +++ src/tail.c 16 Sep 2005 07:21:13 -0000 @@ -40,6 +40,7 @@ #include "posixver.h" #include "quote.h" #include "safe-read.h" +#include "stat-time.h" #include "xnanosleep.h" #include "xstrtol.h" #include "xstrtod.h" @@ -327,8 +328,7 @@ record_open_fd (struct File_spec *f, int { f->fd = fd; f->size = size; - f->mtime.tv_sec = st->st_mtime; - f->mtime.tv_nsec = TIMESPEC_NS (st->st_mtim); + f->mtime = get_stat_mtime (st); f->dev = st->st_dev; f->ino = st->st_ino; f->mode = st->st_mode; @@ -1039,10 +1039,9 @@ tail_forever (struct File_spec *f, int n continue; } - if ((! S_ISREG (stats.st_mode) || f[i].size == stats.st_size) - && f[i].mtime.tv_sec == stats.st_mtime - && f[i].mtime.tv_nsec == TIMESPEC_NS (stats.st_mtim) - && f[i].mode == stats.st_mode) + if (f[i].mode == stats.st_mode + && (! S_ISREG (stats.st_mode) || f[i].size == stats.st_size) + && timespec_cmp (f[i].mtime, get_stat_mtime (&stats)) == 0) { if ((max_n_unchanged_stats_between_opens <= f[i].n_unchanged_stats++) @@ -1057,8 +1056,7 @@ tail_forever (struct File_spec *f, int n /* This file has changed. Print out what we can, and then keep looping. */ - f[i].mtime.tv_sec = stats.st_mtime; - f[i].mtime.tv_nsec = TIMESPEC_NS (stats.st_mtim); + f[i].mtime = get_stat_mtime (&stats); f[i].mode = stats.st_mode; /* reset counter */ Index: src/test.c =================================================================== RCS file: /fetish/cu/src/test.c,v retrieving revision 1.123 diff -p -u -r1.123 test.c --- src/test.c 23 Aug 2005 15:28:22 -0000 1.123 +++ src/test.c 16 Sep 2005 07:21:13 -0000 @@ -45,6 +45,7 @@ #include "euidaccess.h" #include "inttostr.h" #include "quote.h" +#include "stat-time.h" #include "strnumcmp.h" #if HAVE_SYS_PARAM_H @@ -159,20 +160,19 @@ find_int (char const *string) test_syntax_error (_("invalid integer %s\n"), quote (string)); } -/* Find the modification time of FILE, and stuff it into *AGE. - If the timestamp has a nonoseconds part, stuff that into *NS; - otherwise stuff zero into *NS. +/* Find the modification time of FILE, and stuff it into *MTIME. Return true if successful. */ static bool -age_of (char const *filename, time_t *age, long *ns) +get_mtime (char const *filename, struct timespec *mtime) { struct stat finfo; bool ok = (stat (filename, &finfo) == 0); +#ifdef lint + static struct timespec const zero; + *mtime = zero; +#endif if (ok) - { - *age = finfo.st_mtime; - *ns = TIMESPEC_NS (finfo.st_mtim); - } + *mtime = get_stat_mtime (&finfo); return ok; } @@ -322,20 +322,14 @@ binary_operator (bool l_is_l) if (argv[op][2] == 't' && !argv[op][3]) { /* nt - newer than */ - time_t lt IF_LINT (= 0); - time_t rt IF_LINT (= 0); - long l_ns IF_LINT (= 0); - long r_ns IF_LINT (= 0); + struct timespec lt, rt; bool le, re; pos += 3; if (l_is_l | r_is_l) test_syntax_error (_("-nt does not accept -l\n"), NULL); - le = age_of (argv[op - 1], <, &l_ns); - re = age_of (argv[op + 1], &rt, &r_ns); - if (le && re && (rt == lt)) - return l_ns > r_ns; - else - return le > re || (le && lt > rt); + le = get_mtime (argv[op - 1], <); + re = get_mtime (argv[op + 1], &rt); + return le && (!re || timespec_cmp (lt, rt) > 0); } break; @@ -357,20 +351,14 @@ binary_operator (bool l_is_l) if ('t' == argv[op][2] && '\000' == argv[op][3]) { /* ot - older than */ - time_t lt IF_LINT (= 0); - time_t rt IF_LINT (= 0); - long l_ns IF_LINT (= 0); - long r_ns IF_LINT (= 0); + struct timespec lt, rt; bool le, re; pos += 3; if (l_is_l | r_is_l) test_syntax_error (_("-ot does not accept -l\n"), NULL); - le = age_of (argv[op - 1], <, &l_ns); - re = age_of (argv[op + 1], &rt, &r_ns); - if (le && re && (lt == rt)) - return l_ns < r_ns; - else - return le < re || (re && lt < rt); + le = get_mtime (argv[op - 1], <); + re = get_mtime (argv[op + 1], &rt); + return re && (!le || timespec_cmp (lt, rt) < 0); } break; } Index: src/touch.c =================================================================== RCS file: /fetish/cu/src/touch.c,v retrieving revision 1.133 diff -p -u -r1.133 touch.c --- src/touch.c 14 Aug 2005 14:18:07 -0000 1.133 +++ src/touch.c 16 Sep 2005 07:21:13 -0000 @@ -32,6 +32,7 @@ #include "posixver.h" #include "quote.h" #include "safe-read.h" +#include "stat-time.h" #include "utimens.h" /* The official name of this program (e.g., no `g' prefix). */ @@ -170,22 +171,12 @@ touch (const char *file) } else { - if (change_times & CH_ATIME) - timespec[0] = newtime[0]; - else - { - timespec[0].tv_sec = sbuf.st_atime; - timespec[0].tv_nsec = TIMESPEC_NS (sbuf.st_atim); - } - - if (change_times & CH_MTIME) - timespec[1] = newtime[1]; - else - { - timespec[1].tv_sec = sbuf.st_mtime; - timespec[1].tv_nsec = TIMESPEC_NS (sbuf.st_mtim); - } - + timespec[0] = (change_times & CH_ATIME + ? newtime[0] + : get_stat_atime (&sbuf)); + timespec[1] = (change_times & CH_MTIME + ? newtime[1] + : get_stat_mtime (&sbuf)); t = timespec; } @@ -342,10 +333,8 @@ main (int argc, char **argv) if (stat (ref_file, &ref_stats)) error (EXIT_FAILURE, errno, _("failed to get attributes of %s"), quote (ref_file)); - newtime[0].tv_sec = ref_stats.st_atime; - newtime[0].tv_nsec = TIMESPEC_NS (ref_stats.st_atim); - newtime[1].tv_sec = ref_stats.st_mtime; - newtime[1].tv_nsec = TIMESPEC_NS (ref_stats.st_mtim); + newtime[0] = get_stat_atime (&ref_stats); + newtime[1] = get_stat_mtime (&ref_stats); date_set = true; if (flex_date) { --- /dev/null 2005-06-27 15:40:05.000000000 -0700 +++ lib/stat-time.h 2005-09-15 23:20:36.000000000 -0700 @@ -0,0 +1,178 @@ +/* stat-related time functions. + + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#ifndef STAT_TIME_H +#define STAT_TIME_H 1 + +#include "timespec.h" + +/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type + struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, + ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, + if available. ST_XTIM can be st_atim, st_ctim, or st_mtim for + access, status change, or data modification time, respectively. + + These macros are private to stat-time.h. */ +#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) +#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) +#elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec) +#endif + +/* Return the nanosecond component of *ST's access time. */ +static inline long int +get_stat_atime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_atim); +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + return st->st_spare1 * 1000; +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's status change time. */ +static inline long int +get_stat_ctime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_ctim); +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + return st->st_spare3 * 1000; +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's data modification time. */ +static inline long int +get_stat_mtime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_mtim); +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + return st->st_spare2 * 1000; +# else + return 0; +# endif +} + +/* Return *ST's access time. */ +static inline struct timespec +get_stat_atime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim); +#else + struct timespec t; + t.tv_sec = st->st_atime; + t.tv_nsec = get_stat_atime_ns (st); + return t; +#endif +} + +/* Return *ST's status change time. */ +static inline struct timespec +get_stat_ctime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim); +#else + struct timespec t; + t.tv_sec = st->st_ctime; + t.tv_nsec = get_stat_ctime_ns (st); + return t; +#endif +} + +/* Return *ST's data modification time. */ +static inline struct timespec +get_stat_mtime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim); +#else + struct timespec t; + t.tv_sec = st->st_mtime; + t.tv_nsec = get_stat_mtime_ns (st); + return t; +#endif +} + +/* Set *ST's access time. */ +static inline void +set_stat_atime (struct stat *st, struct timespec t) +{ +#ifdef STAT_TIMESPEC + STAT_TIMESPEC (st, st_atim) = t; +#else + st->st_atime = t.tv_sec; +# if defined STAT_TIMESPEC_NS + STAT_TIMESPEC_NS (st, st_atim) = t.tv_nsec; +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + st->st_spare1 = t.tv_nsec / 1000; +# endif +#endif +} + +/* Set *ST's status change time. */ +static inline void +set_stat_ctime (struct stat *st, struct timespec t) +{ +#ifdef STAT_TIMESPEC + STAT_TIMESPEC (st, st_ctim) = t; +#else + st->st_ctime = t.tv_sec; +# if defined STAT_TIMESPEC_NS + STAT_TIMESPEC_NS (st, st_ctim) = t.tv_nsec; +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + st->st_spare1 = t.tv_nsec / 1000; +# endif +#endif +} + +/* Set *ST's data modification time. */ +static inline void +set_stat_mtime (struct stat *st, struct timespec t) +{ +#ifdef STAT_TIMESPEC + STAT_TIMESPEC (st, st_mtim) = t; +#else + st->st_mtime = t.tv_sec; +# if defined STAT_TIMESPEC_NS + STAT_TIMESPEC_NS (st, st_mtim) = t.tv_nsec; +# elif defined HAVE_STRUCT_STAT_ST_SPARE1 + st->st_spare1 = t.tv_nsec / 1000; +# endif +#endif +} + +#endif --- /dev/null 2005-06-27 15:40:05.000000000 -0700 +++ m4/stat-time.m4 2005-08-14 23:46:04.000000000 -0700 @@ -0,0 +1,39 @@ +# Checks for stat-related time functions. + +# Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# st_atim.tv_nsec - Linux, Solaris +# st_atimespec.tv_nsec - FreeBSD, if ! defined _POSIX_SOURCE +# st_atimensec - FreeBSD, if defined _POSIX_SOURCE +# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) +# st_spare1 - Cygwin? + +AC_DEFUN([gl_STAT_TIME], +[ + AC_LIBSOURCES([stat-time.h]) + + AC_REQUIRE([AC_C_INLINE]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_spare1], [], + [], + [#include + #include ])], + [#include + #include ])], + [#include + #include ])], + [#include + #include ])], + [#include + #include ]) +]) From MAILER-DAEMON Fri Sep 16 05:24:34 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGCSP-0003KS-Um for mharc-bug-coreutils@gnu.org; Fri, 16 Sep 2005 05:24:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGCSF-0003GG-1V for bug-coreutils@gnu.org; Fri, 16 Sep 2005 05:24:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGCSC-0003EH-Iq for bug-coreutils@gnu.org; Fri, 16 Sep 2005 05:24:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGCSB-0003D3-No; Fri, 16 Sep 2005 05:24:19 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGCRC-0000g5-2n; Fri, 16 Sep 2005 05:23:18 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 07BDDE81; Fri, 16 Sep 2005 11:23:17 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org, bug-gnulib@gnu.org Date: Fri, 16 Sep 2005 11:23:17 +0200 Message-ID: <87acid1i4a.fsf@rho.meyering.net> Lines: 427 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: fprintftime: a new interface to strftime/nstrftime X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 09:24:27 -0000 I've massaged coreutils' strftime.c so that it can now also define a function called fprintftime. /* A cross between fprintf and nstrftime, that prints directly to the output stream, without the need for the potentially large buffer that nstrftime would require. Output to stream FP the result of formatting (according to the nstrftime format string, FMT) the time data, *TM, and the UTC and NANOSECONDS values. */ size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm, int utc, int nanoseconds); 2005-09-16 Jim Meyering * strftime.c [FPRINTFTIME] (fprintftime): Provide a new interface: size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm, int utc, int nanoseconds); Background: date should not have to allocate a megabyte of virtual memory to handle a format argument like +%1048575T. When implemented with strftime, it must allocate such a buffer, use strftime to fill it in, print it, then free it. With fprintftime, it simply prints everything and exits. With no need for memory allocation, that's one fewer way to fail. * fprintftime.c, fprintftime.h: New files. Now, coreutils' date and du programs use fprintftime in place of xanstrftime (an xmalloc/nstrftime wrapper) and those programs can no longer fail due to out of memory errors that would arise from strftime format string abuse. For now, it's checked in to coreutils, but I plan to merge it back into gnulib. Index: strftime.c =================================================================== RCS file: /fetish/cu/lib/strftime.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -p -u -r1.92 -r1.93 --- strftime.c 15 Sep 2005 18:47:56 -0000 1.92 +++ strftime.c 16 Sep 2005 07:31:29 -0000 1.93 @@ -155,7 +155,24 @@ extern char *tzname[]; #endif -#ifdef COMPILE_WIDE +#ifndef FPRINTFTIME +# define FPRINTFTIME 0 +#endif + +#if FPRINTFTIME +# define STREAM_OR_CHAR_T FILE +# define STRFTIME_ARG(x) /* empty */ +#else +# define STREAM_OR_CHAR_T CHAR_T +# define STRFTIME_ARG(x) x, +#endif + +#if FPRINTFTIME +# define memset_byte(P, Len, Byte) \ + do { size_t _i; for (_i = 0; _i < Len; _i++) fputc (Byte, P); } while (0) +# define memset_space(P, Len) memset_byte (P, Len, ' ') +# define memset_zero(P, Len) memset_byte (P, Len, '0') +#elif defined COMPILE_WIDE # define memset_space(P, Len) (wmemset (P, L' ', Len), (P) += (Len)) # define memset_zero(P, Len) (wmemset (P, L'0', Len), (P) += (Len)) #else @@ -173,7 +190,7 @@ extern char *tzname[]; return 0; \ if (p) \ { \ - if (_delta > 0) \ + if (digits == 0 && _delta > 0) \ { \ if (pad == L_('0')) \ memset_zero (p, _delta); \ @@ -181,12 +198,28 @@ extern char *tzname[]; memset_space (p, _delta); \ } \ f; \ - p += _n; \ + p += FPRINTFTIME ? 0 : _n; \ } \ i += _incr; \ } while (0) -#define cpy(n, s) \ +#if FPRINTFTIME +# define add1(C) add (1, fputc (C, p)) +#else +# define add1(C) add (1, *p = C) +#endif + +#if FPRINTFTIME +# define cpy(n, s) \ + add ((n), \ + if (to_lowcase) \ + fwrite_lowcase (p, (s), _n); \ + else if (to_uppcase) \ + fwrite_uppcase (p, (s), _n); \ + else \ + fwrite ((s), _n, 1, p)) +#else +# define cpy(n, s) \ add ((n), \ if (to_lowcase) \ memcpy_lowcase (p, (s), _n LOCALE_ARG); \ @@ -194,6 +227,7 @@ extern char *tzname[]; memcpy_uppcase (p, (s), _n LOCALE_ARG); \ else \ MEMCPY ((void *) p, (void const *) (s), _n)) +#endif #ifdef COMPILE_WIDE # ifndef USE_IN_EXTENDED_LOCALE_MODEL @@ -263,6 +297,27 @@ extern char *tzname[]; more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) +#if FPRINTFTIME +static void +fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len) +{ + while (len-- > 0) + { + fputc (TOLOWER ((UCHAR_T) *src, loc), fp); + ++src; + } +} + +static void +fwrite_uppcase (FILE *fp, const CHAR_T *src, size_t len) +{ + while (len-- > 0) + { + fputc (TOUPPER ((UCHAR_T) *src, loc), fp); + ++src; + } +} +#else static CHAR_T * memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_PROTO) @@ -280,6 +335,7 @@ memcpy_uppcase (CHAR_T *dest, const CHAR dest[len] = TOUPPER ((UCHAR_T) src[len], loc); return dest; } +#endif #if ! HAVE_TM_GMTOFF @@ -355,11 +411,16 @@ static CHAR_T const month_name[][10] = # define my_strftime nstrftime #endif +#if FPRINTFTIME +# undef my_strftime +# define my_strftime fprintftime +#endif + #ifdef my_strftime # define extra_args , ut, ns # define extra_args_spec , int ut, int ns #else -# ifdef COMPILE_WIDE +# if defined COMPILE_WIDE # define my_strftime wcsftime # define nl_get_alt_digit _nl_get_walt_digit # else @@ -374,19 +435,20 @@ static CHAR_T const month_name[][10] = #endif -/* Write information from TP into S according to the format - string FORMAT, writing no more that MAXSIZE characters - (including the terminating '\0') and returning number of - characters written. If S is NULL, nothing will be written - anywhere, so to determine how many characters would be - written, use NULL for S and (size_t) -1 for MAXSIZE. */ -size_t -my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, - const struct tm *tp extra_args_spec LOCALE_PARAM_PROTO) +/* Just like my_strftime, below, but with one more parameter, UPCASE, + to indicate that the result should be converted to upper case. */ +static size_t +strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s, + STRFTIME_ARG (size_t maxsize) + const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_PROTO) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *const current = loc->__locales[LC_TIME]; #endif +#if FPRINTFTIME + size_t maxsize = (size_t) -1; +#endif int hour12 = tp->tm_hour; #ifdef _NL_CURRENT @@ -426,7 +488,7 @@ my_strftime (CHAR_T *s, size_t maxsize, #endif const char *zone; size_t i = 0; - CHAR_T *p = s; + STREAM_OR_CHAR_T *p = s; const CHAR_T *f; #if DO_MULTIBYTE && !defined COMPILE_WIDE const char *format_end = NULL; @@ -477,7 +539,7 @@ my_strftime (CHAR_T *s, size_t maxsize, { int pad = 0; /* Padding for number ('-', '_', or 0). */ int modifier; /* Field modifier ('E', 'O', or 0). */ - int digits; /* Max digits for numeric format. */ + int digits = 0; /* Max digits for numeric format. */ int number_value; /* Numeric value to be printed. */ unsigned int u_number_value; /* (unsigned int) number_value. */ bool negative_number; /* The number is negative. */ @@ -486,12 +548,14 @@ my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *subfmt; CHAR_T sign_char; CHAR_T *bufp; - CHAR_T buf[1 + (sizeof (int) < sizeof (time_t) - ? INT_STRLEN_BOUND (time_t) - : INT_STRLEN_BOUND (int))]; + CHAR_T buf[1 + + 2 /* for the two colons in a %::z or %:::z time zone */ + + (sizeof (int) < sizeof (time_t) + ? INT_STRLEN_BOUND (time_t) + : INT_STRLEN_BOUND (int))]; int width = -1; bool to_lowcase = false; - bool to_uppcase = false; + bool to_uppcase = upcase; size_t colons; bool change_case = false; int format_char; @@ -527,7 +591,7 @@ my_strftime (CHAR_T *s, size_t maxsize, be in the basic execution character set. None of these characters can start a multibyte sequence, so they need not be analyzed further. */ - add (1, *p = *f); + add1 (*f); continue; default: @@ -578,7 +642,7 @@ my_strftime (CHAR_T *s, size_t maxsize, or this is the wide character version. */ if (*f != L_('%')) { - add (1, *p = *f); + add1 (*f); continue; } @@ -654,6 +718,10 @@ my_strftime (CHAR_T *s, size_t maxsize, digits = d; \ negative_number = negative; \ u_number_value = v; goto do_signed_number + + /* The mask is not what you might think. + When the ordinal i'th bit is set, insert a colon + before the i'th digit of the time zone representation. */ #define DO_TZ_OFFSET(d, negative, mask, v) \ digits = d; \ negative_number = negative; \ @@ -666,7 +734,7 @@ my_strftime (CHAR_T *s, size_t maxsize, case L_('%'): if (modifier != 0) goto bad_format; - add (1, *p = *f); + add1 (*f); break; case L_('a'): @@ -750,18 +818,14 @@ my_strftime (CHAR_T *s, size_t maxsize, subformat: { - CHAR_T *old_start = p; - size_t len = my_strftime (NULL, (size_t) -1, subfmt, - tp extra_args LOCALE_ARG); - add (len, my_strftime (p, maxsize - i, subfmt, - tp extra_args LOCALE_ARG)); - - if (to_uppcase) - while (old_start < p) - { - *old_start = TOUPPER ((UCHAR_T) *old_start, loc); - ++old_start; - } + size_t len = strftime_case_ (to_uppcase, + NULL, STRFTIME_ARG ((size_t) -1) + subfmt, + tp extra_args LOCALE_ARG); + add (len, strftime_case_ (to_uppcase, p, + STRFTIME_ARG (maxsize - i) + subfmt, + tp extra_args LOCALE_ARG)); } break; @@ -864,7 +928,7 @@ my_strftime (CHAR_T *s, size_t maxsize, DO_NUMBER_SPACEPAD (2, tp->tm_mday); /* All numeric formats set DIGITS and NUMBER_VALUE (or U_NUMBER_VALUE) - and then jump to one of these three labels. */ + and then jump to one of these labels. */ do_tz_offset: always_output_a_sign = true; @@ -937,13 +1001,15 @@ my_strftime (CHAR_T *s, size_t maxsize, : always_output_a_sign ? L_('+') : 0); - if (sign_char) - *--bufp = sign_char; - - if (pad != L_('-')) + if (pad == L_('-')) + { + if (sign_char) + add1 (sign_char); + } + else { int padding = digits - (buf + (sizeof (buf) / sizeof (buf[0])) - - bufp); + - bufp) - !!sign_char; if (padding > 0) { @@ -956,6 +1022,8 @@ my_strftime (CHAR_T *s, size_t maxsize, memset_space (p, padding); i += padding; width = width > padding ? width - padding : 0; + if (sign_char) + add1 (sign_char); } else { @@ -963,13 +1031,7 @@ my_strftime (CHAR_T *s, size_t maxsize, return 0; if (sign_char) - { - ++bufp; - - if (p) - *p++ = sign_char; - ++i; - } + add1 (sign_char); if (p) memset_zero (p, padding); @@ -977,6 +1039,11 @@ my_strftime (CHAR_T *s, size_t maxsize, width = 0; } } + else + { + if (sign_char) + add1 (sign_char); + } } cpy (buf + sizeof (buf) / sizeof (buf[0]) - bufp, bufp); @@ -1050,7 +1117,7 @@ my_strftime (CHAR_T *s, size_t maxsize, #endif case L_('n'): - add (1, *p = L_('\n')); + add1 (L_('\n')); break; case L_('P'): @@ -1145,7 +1212,7 @@ my_strftime (CHAR_T *s, size_t maxsize, goto subformat; case L_('t'): - add (1, *p = L_('\t')); + add1 (L_('\t')); break; case L_('u'): @@ -1413,16 +1480,35 @@ my_strftime (CHAR_T *s, size_t maxsize, } } +#if ! FPRINTFTIME if (p && maxsize != 0) *p = L_('\0'); +#endif + return i; } -#ifdef _LIBC + +/* Write information from TP into S according to the format + string FORMAT, writing no more that MAXSIZE characters + (including the terminating '\0') and returning number of + characters written. If S is NULL, nothing will be written + anywhere, so to determine how many characters would be + written, use NULL for S and (size_t) -1 for MAXSIZE. */ +size_t +my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) + const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_PROTO) +{ + return strftime_case_ (false, s, STRFTIME_ARG (maxsize) + format, tp extra_args LOCALE_ARG); +} + +#if defined _LIBC && ! FPRINTFTIME libc_hidden_def (my_strftime) #endif -#ifdef emacs +#if defined emacs && ! FPRINTFTIME /* For Emacs we have a separate interface which corresponds to the normal strftime function plus the ut argument, but without the ns argument. */ size_t From MAILER-DAEMON Fri Sep 16 12:39:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGJFj-0001Di-Li for mharc-bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:39:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGJFb-0001Bg-HG for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:39:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGJFW-00018j-GK for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:39:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGJFU-00014s-VE for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:39:41 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGJBc-0005uA-CX for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:35:40 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8GGZY413790; Fri, 16 Sep 2005 09:35:34 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EGJBV-0001rq-Oi; Fri, 16 Sep 2005 09:35:33 -0700 To: Jorge Infante References: <161b3e2205081105017bf70414@mail.gmail.com> From: Paul Eggert Date: Fri, 16 Sep 2005 09:35:33 -0700 In-Reply-To: <161b3e2205081105017bf70414@mail.gmail.com> (Jorge Infante's message of "Thu, 11 Aug 2005 09:01:12 -0300") Message-ID: <8764t1nf6y.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: join problem? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 16:39:48 -0000 Jorge Infante writes in : > I'm running: > join -t "|" -j 1 -a 2 file1 file2 > The result is: > 163|reg000524 > I have a record with value "163" in file2. > Is a bug? No, because join assumes that the input is sorted lexicographically. Your input was sorted numerically, which is a different thing. Perhaps "join" should have an option to assume numeric sort, but that would be an enhancement. From MAILER-DAEMON Fri Sep 16 13:23:54 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGJwI-0005D3-1P for mharc-bug-coreutils@gnu.org; Fri, 16 Sep 2005 13:23:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGIdY-00055w-Fv for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:00:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGIdH-00050O-Vh for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:00:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGIdF-0004wr-Ep for bug-coreutils@gnu.org; Fri, 16 Sep 2005 12:00:09 -0400 Received: from [213.84.46.114] (helo=keetweej.vanheusden.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EGIWI-0002eN-8e for bug-coreutils@gnu.org; Fri, 16 Sep 2005 11:52:58 -0400 Received: from keetweej.intranet.vanheusden.com (keetweej.intranet.vanheusden.com [192.168.64.99]) by keetweej.vanheusden.com (Postfix) with ESMTP id 42B2D1CA375; Fri, 16 Sep 2005 17:52:54 +0200 (CEST) Date: Fri, 16 Sep 2005 17:52:53 +0200 From: Folkert van Heusden To: bug-coreutils@gnu.org Message-ID: <20050916155250.GA17290@vanheusden.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="L6iaP+gRLNZHKoI4" Content-Disposition: inline Organization: www.unixexpert.nl X-Chameleon-Return-To: folkert@vanheusden.com X-Xfmail-Return-To: folkert@vanheusden.com X-Phonenumber: +31-6-41278122 X-URL: http://www.vanheusden.com/ X-PGP-KeyID: 1F28D8AE X-GPG-fingerprint: AC89 09CE 41F2 00B4 FCF2 B174 3019 0E8C 1F28 D8AE X-Key: http://pgp.surfnet.nl:11371/pks/lookup?op=get&search=0x1F28D8AE Read-Receipt-To: Reply-By: Sat Sep 17 17:31:08 CEST 2005 X-MSMail-Priority: High X-Message-Flag: www.unixexpert.nl User-Agent: Mutt/1.5.10i X-Mailman-Approved-At: Fri, 16 Sep 2005 13:23:53 -0400 Cc: rsw@amc.nl, rsw@hamal.nl Subject: dd progress X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 16:00:37 -0000 --L6iaP+gRLNZHKoI4 Content-Type: multipart/mixed; boundary="z6Eq5LdranGa6ru8" Content-Disposition: inline --z6Eq5LdranGa6ru8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Attached you'll find a patch which adds a progress indicator to 'dd'. Output shown is the number of processed bytes. Folkert van Heusden --=20 Try MultiTail! Multiple windows with logfiles, filtered with regular expressions, colored output, etc. etc. www.vanheusden.com/multitail/ ---------------------------------------------------------------------- Get your PGP/GPG key signed at www.biglumber.com! ---------------------------------------------------------------------- Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com --z6Eq5LdranGa6ru8 Content-Type: application/octet-stream Content-Disposition: attachment; filename="coreutils-5.2.1_dd.patch.bz2" Content-Transfer-Encoding: base64 QlpoOTFBWSZTWY1/MgUAAylfgD4we////39v/+7/79/+UAUd4z21QA5HpoKA0IVP0pp6n6Sb amkaaPUPKA0Gj1DENADQADQaA0qZBoepo00ANAAAAAAAAADQBFPVNqb1Q00AGgAAAGgZAAAA AADFBU3pNPUgMNEAaDTEAABoNAAAACSETTQmhqYTRpklPU/TSm001P0kwMRPSeoeo8UZGzU0 epOJIpgLKgwLnmSa1EZ35SYulM/hILKx1VcwyYyM4cshjbKpOL/eRwb7OzzeeWgzBpGWTM2d jHYZ7NHqxut2beq7863w+i0z3yAXEAYAUzVDCYBkanDOywsbpfnZUZMe/rp9JoCBjndpI1e2 N5avbIdx/SN//NoPLK1ANuigixs6YgIRUBQncIposUebqtEIx5AIJ5FgwtAtEZSg3d+MPtjA T6Yt8glSTBptXfbfUng+xmUsLp9DIr2COo5GZwlKP5xARsGJceIzoYoOAJIUWLIyQtkwaIAT kMZqb8HfwjnxfkMTCJMmo/fMHzfqrbDtb03vrbWNUHNKvjmbdrwtcyBS1rN69WsDrgTdF3Ew tSy9AQEulWVVBkUQMEHKHTHb5uiju3uxMeQzKmsv6LZ8YypS/0Izo4AGoZhkOERk0NH1ZfH6 CKHZjFq1msBnQcqkYdOWcRmFE3cOAMAwMHXQAxU8KhQW+7jy/2v06cuAQIkIxvMucdWB8b9/ HTxuDsCvoYvyDxh5KDDDV3gUOo1xvKangINZugPMEC2zzj+xyIayjDspyMEdxVPWkd4YxKX3 WzAdSkzeQd2JmPaWXtaIYnrGYpED24nlxs0WWVnNrhwn37KkmyzkU4s6zFQK2vW1K4YML9F8 ycyJQTvLbYwrW+JNH69dfC3CF/SH74yHdx8kfP+DgZ2RsL7+g+fyhZ94gZB40HzYKFa3v/92 C5CS9Qx8SXpj4fWvwaPYdtS+VcXL/hgZjxPX6wZwlgNj8bsws5eGk7Remztbs5B5et8iRVv2 Mt2YXLdREtg12tXTGLaG6ZkR8aMMy2QeU5fxjJZ8dWetSVoOoL20FCRT6z643gJJZtRmbY4B oq1aGCcNTPMTwsuFp5C6Up6AiONPaQGPohtsQUCmC6ROKF7SFiSBlnwIoOLE2PY4vZdKp58x 7GZmmia5lEh2sCE0xxaBcYoy6RgM2G4d2udRAWpmh4AdY1Kf5Al8gtKr2FkBWRy3QdzAz7rN xFKGyfriC1Mn8XqkpbUUYK+PfUol7M8WTOkSVCqAPJJNJshMZGCYRYuCenBuiRjAhqI4HAhj ay50XnBHMVGH/2b5lhM/S3pntkcpyBiF1rf9flwMUGX8DawOZFDxOuprEFOmw7mmoyg0m0tN Rw7qgn9Bh51MVpsoiYIS5hEsfQXzyRXrQaRVBxHk5LK5s4zju/iKZcpCGVRbX9viD5COFC8Y dPB1MODh8vDDwLmkVFRWu5WcpEHO9oyK2wZSKMigzHAn3vyfctonE6Ce7zlZ2G0LGNsi2BHg DdkUXQFOnigwWGTONOlj97RnNwSGPAn1343DA1CRzEwfsGI361OVHMAswVwNyW70amC4S7x1 sCnet7XsEaBiE5WCnVKAbUBFEyU3FhpPN/F5ddEbzRcYw27e2uG3kVFzpu4ZausKIWyQZmr1 Jww1/Zn05ZtZlFqbNgSWt5SB5+eS52SrVWiWaHq1klaYrYxYqiNEZ2LJ5eSQ9F42J69pzC5x eCvXxnkWfbsCBYiPRBBpOQvfPSILEGyDtmFt9r5qEg5Ujw7BvcO7fuLuSKcKEhGv5kCg --z6Eq5LdranGa6ru8-- --L6iaP+gRLNZHKoI4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iIMEARECAEMFAkMq6lI8Gmh0dHA6Ly93d3cudmFuaGV1c2Rlbi5jb20vZGF0YS1z aWduaW5nLXdpdGgtcGdwLXBvbGljeS5odG1sAAoJEDAZDowfKNiujVUAn299J4Lu o8IAH+feMUVSniFq6ev5AKCYD7azIfkuwsCV6k3pWiP1g1eQMQ== =iKZH -----END PGP SIGNATURE----- --L6iaP+gRLNZHKoI4-- From MAILER-DAEMON Sat Sep 17 02:57:43 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGWdp-0002nO-J4 for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 02:57:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGWdP-0002Yj-KJ for bug-coreutils@gnu.org; Sat, 17 Sep 2005 02:57:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGWdN-0002Xq-QZ for bug-coreutils@gnu.org; Sat, 17 Sep 2005 02:57:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGWdL-0002Vk-BO; Sat, 17 Sep 2005 02:57:11 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGWdJ-0006co-Ct; Sat, 17 Sep 2005 02:57:09 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8H6v8407166; Fri, 16 Sep 2005 23:57:08 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EGWdI-0005lI-1M; Fri, 16 Sep 2005 23:57:08 -0700 To: bug-gnulib@gnu.org, bug-coreutils@gnu.org Message-Id: From: Paul Eggert Date: Fri, 16 Sep 2005 23:57:08 -0700 Cc: Subject: stat-time.h simplification: withdraw set_stat_atime etc. X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 06:57:17 -0000 X-List-Received-Date: Sat, 17 Sep 2005 06:57:17 -0000 I installed the following into both gnulib and coreutils to simplify the recently added stat-time.h module a bit: 2005-09-16 Paul Eggert * stat-time.h (set_stat_atime, set_stat_ctime, set_stat_mtime): Remove; they were buggy in the HAVE_STRUCT_STAT_ST_SPARE1 case, and they were dubious anyway. I rewrote 'tar' to not use them any more. Index: stat-time.h =================================================================== RCS file: /fetish/cu/lib/stat-time.h,v retrieving revision 1.1 retrieving revision 1.2 diff -p -u -r1.1 -r1.2 --- stat-time.h 16 Sep 2005 07:36:48 -0000 1.1 +++ stat-time.h 17 Sep 2005 06:54:22 -0000 1.2 @@ -127,52 +127,4 @@ get_stat_mtime (struct stat const *st) #endif } -/* Set *ST's access time. */ -static inline void -set_stat_atime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_atim) = t; -#else - st->st_atime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_atim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - -/* Set *ST's status change time. */ -static inline void -set_stat_ctime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_ctim) = t; -#else - st->st_ctime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_ctim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - -/* Set *ST's data modification time. */ -static inline void -set_stat_mtime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_mtim) = t; -#else - st->st_mtime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_mtim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - #endif From MAILER-DAEMON Sat Sep 17 11:29:52 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGedT-0001QW-Qk for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 11:29:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGedS-0001Pb-0y for bug-coreutils@gnu.org; Sat, 17 Sep 2005 11:29:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGedQ-0001Or-C5 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 11:29:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGebt-0000PI-5T for bug-coreutils@gnu.org; Sat, 17 Sep 2005 11:28:13 -0400 Received: from [212.23.3.142] (helo=rutherford.zen.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGeIC-0007Qm-Oe; Sat, 17 Sep 2005 11:07:52 -0400 Received: from loudhoward.flamingmonkeys.co.uk ([82.70.9.140] helo=[127.0.0.1]) by rutherford.zen.co.uk with esmtp (Exim 4.34) id 1EGeIA-00053K-5J; Sat, 17 Sep 2005 15:07:50 +0000 Message-ID: <432C32C6.8030807@jguk.org> Date: Sat, 17 Sep 2005 16:14:14 +0100 From: "J. Grant" User-Agent: Mozilla/5.0 (X11; U; GNU/Linux i686; en; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en, ja MIME-Version: 1.0 To: bug-coreutils@gnu.org, webmasters@www.gnu.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Rutherford-IP: [82.70.9.140] Cc: Subject: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 15:29:50 -0000 Hi, Just following up old emails. I've not received a reply, could you confirm if you received my email please? Kind regards JG -------- Original Message -------- Subject: cat: invalid option -- h Date: Tue, 14 Jan 2003 17:05:19 +0000 From: J. Grant To: bug-textutils@gnu.org Hi, Can cat -h be added as an alias of --help please? Regards JG $ cat -h cat: invalid option -- h Try `cat --help' for more information. From MAILER-DAEMON Sat Sep 17 12:04:28 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGfAx-0004tZ-Jz for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:04:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGfAv-0004sl-7j for bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:04:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGfAt-0004rQ-3Y for bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:04:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGfAs-0004qk-Nu for bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:04:22 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGfAo-0002WR-Te; Sat, 17 Sep 2005 12:04:19 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id 1071D178; Sat, 17 Sep 2005 18:04:17 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14344; Sat, 17 Sep 05 18:04:07 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id 0EC6912A; Sat, 17 Sep 2005 18:04:07 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id EEF3844004; Sat, 17 Sep 2005 18:04:06 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15155-02-16; Sat, 17 Sep 2005 18:04:05 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 5B10844003; Sat, 17 Sep 2005 18:04:05 +0200 (CEST) Received: (nullmailer pid 27103 invoked by uid 30270); Sat, 17 Sep 2005 16:04:05 -0000 From: "Alfred M\. Szmidt" To: "J\. Grant" In-reply-to: <432C32C6.8030807@jguk.org> References: <432C32C6.8030807@jguk.org> Date: Sat, 17 Sep 2005 18:04:05 +0200 Message-Id: <1126973045.125710.27102.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org, webmasters@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 16:04:25 -0000 I've not received a reply, could you confirm if you received my email please? Sure. Can cat -h be added as an alias of --help please? Why? Seems utterly useless for --help, rather save it for something that is potentionally useful. Cheers. From MAILER-DAEMON Sat Sep 17 13:03:34 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGg6A-0002Zd-BI for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:03:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGg69-0002ZJ-Dj for bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:03:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGfzy-0000wD-G6 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:57:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGfzt-0000iE-Ve for bug-coreutils@gnu.org; Sat, 17 Sep 2005 12:57:06 -0400 Received: from [212.23.3.141] (helo=heisenberg.zen.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGfj5-0004n6-UO; Sat, 17 Sep 2005 12:39:44 -0400 Received: from loudhoward.flamingmonkeys.co.uk ([82.70.9.140] helo=[127.0.0.1]) by heisenberg.zen.co.uk with esmtp (Exim 4.30) id 1EGfj4-0002ls-96; Sat, 17 Sep 2005 16:39:42 +0000 Message-ID: <432C484C.5040303@jguk.org> Date: Sat, 17 Sep 2005 17:46:04 +0100 From: "J. Grant" User-Agent: Mozilla/5.0 (X11; U; GNU/Linux i686; en; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en, ja MIME-Version: 1.0 To: ams@gnu.org References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> In-Reply-To: <1126973045.125710.27102.nullmailer@Update.UU.SE> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Heisenberg-IP: [82.70.9.140] Cc: bug-coreutils@gnu.org, webmasters@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 17:03:33 -0000 Hi Alfred, Thanks for your reply. > Can cat -h be added as an alias of --help please? > > Why? Seems utterly useless for --help, rather save it for something > that is potentionally useful. The GNU convention is to support the short getopt, and getoptlong style in many utils for example, objcopy -h --help Display this output and strings: -h --help Display this information So why should cat be any different? Are doubt there are extra features for cat which require any extra arguments as it comes from the POSIX specs.. Kind regards JG From MAILER-DAEMON Sat Sep 17 13:31:58 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGgXd-0002bT-TV for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:31:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGgXb-0002b8-NW for bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:31:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGgXa-0002aU-87 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:31:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGgXa-0002aK-5R for bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:31:54 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGgXB-0007ns-OR for bug-coreutils@gnu.org; Sat, 17 Sep 2005 13:31:29 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id EEE28123; Sat, 17 Sep 2005 19:31:28 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14345; Sat, 17 Sep 05 19:31:17 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id 1EFE3123; Sat, 17 Sep 2005 19:31:16 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id C670844004; Sat, 17 Sep 2005 19:31:16 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21001-01; Sat, 17 Sep 2005 19:31:16 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 414AF44003; Sat, 17 Sep 2005 19:31:15 +0200 (CEST) Received: (nullmailer pid 27247 invoked by uid 30270); Sat, 17 Sep 2005 17:31:15 -0000 From: "Alfred M\. Szmidt" To: "J\. Grant" In-reply-to: <432C484C.5040303@jguk.org> References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> Date: Sat, 17 Sep 2005 19:31:15 +0200 Message-Id: <1126978275.107157.27246.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 17:31:56 -0000 [webmasters@gnu.org removed from CC] So why should cat be any different? Just because two extreme cases support -h as a alias for --help, doesn't mean that it is a GNU convention. You still haven't given a good reason why -h should be a alias for --help. -h is quite uncommon as a alias for --help in GNU programs, and --help is not that frequently used to warrent a short-option for --help. Infact, just in binutils, objdump uses -H as a alias, -h is a alias for --section-headers. Frankly, adding -h as a alias for --help only causes confusion for users, and any such alias should be removed. From MAILER-DAEMON Sat Sep 17 14:29:17 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGhR7-0007A1-7S for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 14:29:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGhR5-00079K-4X for bug-coreutils@gnu.org; Sat, 17 Sep 2005 14:29:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGhR2-00078A-Uf for bug-coreutils@gnu.org; Sat, 17 Sep 2005 14:29:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGhQR-0006ml-BL for bug-coreutils@gnu.org; Sat, 17 Sep 2005 14:28:35 -0400 Received: from [212.23.3.140] (helo=pythagoras.zen.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGh1z-0001RO-2H; Sat, 17 Sep 2005 14:03:19 -0400 Received: from loudhoward.flamingmonkeys.co.uk ([82.70.9.140] helo=[127.0.0.1]) by pythagoras.zen.co.uk with esmtp (Exim 4.30) id 1EGh1x-0004y3-3V; Sat, 17 Sep 2005 18:03:17 +0000 Message-ID: <432C5BE4.7000104@jguk.org> Date: Sat, 17 Sep 2005 19:09:40 +0100 From: "J. Grant" User-Agent: Mozilla/5.0 (X11; U; GNU/Linux i686; en; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en, ja MIME-Version: 1.0 To: ams@gnu.org References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> <1126978275.107157.27246.nullmailer@Update.UU.SE> In-Reply-To: <1126978275.107157.27246.nullmailer@Update.UU.SE> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Pythagoras-IP: [82.70.9.140] Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 18:29:15 -0000 Hi, On 17/09/05 18:31, Alfred M. Szmidt wrote: > [webmasters@gnu.org removed from CC] > > So why should cat be any different? > > Just because two extreme cases support -h as a alias for --help, > doesn't mean that it is a GNU convention. You still haven't given a > good reason why -h should be a alias for --help. It is a common getopt option to trigger command line help, the most common I suggest. --help is the most common getoptlong option in GNU. Perhaps there is a GNU standard which covers this aspect of programs user-friendly-ness. > -h is quite uncommon as a alias for --help in GNU programs, and --help > is not that frequently used to warrent a short-option for --help. > Infact, just in binutils, objdump uses -H as a alias, -h is a alias > for --section-headers. Frankly, adding -h as a alias for --help only > causes confusion for users, and any such alias should be removed. We'll all have to remember to use --help long option if -h is not going to be consistent then. We can agree to differ on that if you cannot agree with my proposal. Kind regards JG From MAILER-DAEMON Sat Sep 17 15:00:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGhvR-00076U-VN for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:00:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGhvL-00071A-Lt for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:00:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGhvD-0006x8-M5 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:00:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGhvB-0006kD-U4 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:00:22 -0400 Received: from [216.148.227.89] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGhjI-0003jj-VF; Sat, 17 Sep 2005 14:48:05 -0400 Received: from 204.127.197.116 ([204.127.197.116]) by comcast.net (rwcrmhc14) with SMTP id <2005091718480201400oifdce>; Sat, 17 Sep 2005 18:48:02 +0000 Received: from [67.172.242.110] by 204.127.197.116; Sat, 17 Sep 2005 18:48:02 +0000 From: ericblake@comcast.net (Eric Blake) To: "J. Grant" , ams@gnu.org Date: Sat, 17 Sep 2005 18:48:02 +0000 Message-Id: <091720051848.15702.432C64E2000515DF00003D5622007348300A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 19:00:34 -0000 > > > > Just because two extreme cases support -h as a alias for --help, > > doesn't mean that it is a GNU convention. You still haven't given a > > good reason why -h should be a alias for --help. > > It is a common getopt option to trigger command line help, the most > common I suggest. --help is the most common getoptlong option in GNU. > Perhaps there is a GNU standard which covers this aspect of programs > user-friendly-ness. The GNU coding standards ONLY require --help, and not -h, because of the fact that -h is ambiguous and some commands already have it standardized to mean something other than help. If you want help from a GNU program, --help is the only spelling that is guaranteed to work. > We'll all have to remember to use --help long option if -h is not going > to be consistent then. We can agree to differ on that if you cannot > agree with my proposal. You are correct - coreutils is not going to add -h where it does not already exist, because --help already exists. -- Eric Blake From MAILER-DAEMON Sat Sep 17 15:03:04 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGhxn-000813-Kz for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:03:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGhxk-0007zf-Bw for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:03:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGhxi-0007yf-Gx for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:02:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGhxi-0007xi-2d for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:02:58 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGhwu-0004Vq-Bd for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:02:08 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id C0CF512A; Sat, 17 Sep 2005 21:02:07 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14344; Sat, 17 Sep 05 21:01:58 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id CF764108; Sat, 17 Sep 2005 21:01:58 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id BF1D044004; Sat, 17 Sep 2005 21:01:58 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16969-03-4; Sat, 17 Sep 2005 21:01:58 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 34FE344003; Sat, 17 Sep 2005 21:01:58 +0200 (CEST) Received: (nullmailer pid 27374 invoked by uid 30270); Sat, 17 Sep 2005 19:01:58 -0000 From: "Alfred M\. Szmidt" To: "J\. Grant" In-reply-to: <432C5BE4.7000104@jguk.org> References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> <1126978275.107157.27246.nullmailer@Update.UU.SE> <432C5BE4.7000104@jguk.org> Date: Sat, 17 Sep 2005 21:01:58 +0200 Message-Id: <1126983718.105545.27373.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 19:03:02 -0000 We'll all have to remember to use --help long option if -h is not going to be consistent then. Your argument really doesn't make any sense. -h is used for other things than getting a usage message in GNU tools, making -h a alias for --help in some GNU tools would only lead to utter confusion. Right now all you have to remeber is `--help', where as with your proposal you'll have to remeber that objcopy's -h produces a usage message, df outputs things in a human readable format, string outputs a usage message, tar dereferences symbolic links, etc etc etc. Sorry, but --help is consistent, -h is not. -? is infact more common than -h since argp uses this as a alias for --help. From MAILER-DAEMON Sat Sep 17 15:37:40 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGiPr-0006Gb-2U for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:32:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGiPe-0006A8-SX for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:31:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGiPW-00066V-OK for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:31:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGiPT-0005zn-N3 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:31:39 -0400 Received: from [212.23.3.140] (helo=pythagoras.zen.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGiFC-0005XK-59; Sat, 17 Sep 2005 15:21:02 -0400 Received: from loudhoward.flamingmonkeys.co.uk ([82.70.9.140] helo=[127.0.0.1]) by pythagoras.zen.co.uk with esmtp (Exim 4.30) id 1EGiFA-0007c5-5k; Sat, 17 Sep 2005 19:21:00 +0000 Message-ID: <432C6E1C.3000801@jguk.org> Date: Sat, 17 Sep 2005 20:27:24 +0100 From: "J. Grant" User-Agent: Mozilla/5.0 (X11; U; GNU/Linux i686; en; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en, ja MIME-Version: 1.0 To: ams@gnu.org References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> <1126978275.107157.27246.nullmailer@Update.UU.SE> <432C5BE4.7000104@jguk.org> <1126983718.105545.27373.nullmailer@Update.UU.SE> In-Reply-To: <1126983718.105545.27373.nullmailer@Update.UU.SE> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Pythagoras-IP: [82.70.9.140] Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 19:31:53 -0000 Hi, On 17/09/05 20:01, Alfred M. Szmidt wrote: > We'll all have to remember to use --help long option if -h is not going > to be consistent then. > > Your argument really doesn't make any sense. -h is used for other > things than getting a usage message in GNU tools, making -h a alias > for --help in some GNU tools would only lead to utter confusion. > Right now all you have to remeber is `--help', where as with your > proposal you'll have to remeber that objcopy's -h produces a usage > message, df outputs things in a human readable format, string outputs > a usage message, tar dereferences symbolic links, etc etc etc. > > Sorry, but --help is consistent, -h is not. -? is infact more common > than -h since argp uses this as a alias for --help. My point is for consistency, it is unclear what the strategy is with -h in GNU tools, perhaps only a partial idea to use -h for help in some tools. -h has ended up being used for other purposes than help in GNU tools. The fact remains that -h is often used for help in GNU tools, but not in all cases. So I think GNU tools should be consistant, be that in having a -h option for help, or not using -h option for help in some GNU tools. If the strategy is actually to only have --help, perhaps GNU should define that somehwere, as obviously at present many GNU tools are supporting the -h option for help. I don't mind either way, but things should be consitent which ever way it is. Kind regards JG From MAILER-DAEMON Sat Sep 17 15:59:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGiq5-0004UX-Uf for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:59:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGiq3-0004SK-D9 for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:59:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGiq1-0004Qm-DA for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:59:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGioc-0003bH-9X for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:57:38 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGiSd-0006ey-SW for bug-coreutils@gnu.org; Sat, 17 Sep 2005 15:34:56 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 069081CE; Sat, 17 Sep 2005 21:34:54 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26650; Sat, 17 Sep 05 21:34:48 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 97B34185; Sat, 17 Sep 2005 21:34:48 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 63EC244004; Sat, 17 Sep 2005 21:34:48 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25567-01-13; Sat, 17 Sep 2005 21:34:47 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id D7E2244003; Sat, 17 Sep 2005 21:34:47 +0200 (CEST) Received: (nullmailer pid 27427 invoked by uid 30270); Sat, 17 Sep 2005 19:34:47 -0000 From: "Alfred M\. Szmidt" To: "J\. Grant" In-reply-to: <432C6E1C.3000801@jguk.org> References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> <1126978275.107157.27246.nullmailer@Update.UU.SE> <432C5BE4.7000104@jguk.org> <1126983718.105545.27373.nullmailer@Update.UU.SE> <432C6E1C.3000801@jguk.org> Date: Sat, 17 Sep 2005 21:34:47 +0200 Message-Id: <1126985687.736024.27426.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 19:59:08 -0000 -h has ended up being used for other purposes than help in GNU tools. The fact remains that -h is often used for help in GNU tools, but not in all cases. It is not used as often as you might think, -? is more common. From MAILER-DAEMON Sat Sep 17 16:27:04 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGjH5-0003hO-BD for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:27:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGjGz-0003fI-1p for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:26:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGjGw-0003dl-AP for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:26:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGjGv-0003d2-VW for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:26:54 -0400 Received: from [204.127.198.35] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGjEW-00014g-K7; Sat, 17 Sep 2005 16:24:24 -0400 Received: from 204.127.197.111 (rmailcenter74.comcast.net[204.127.197.156]) by comcast.net (rwcrmhc11) with SMTP id <2005091720242301300gu35me>; Sat, 17 Sep 2005 20:24:23 +0000 Received: from [67.172.242.110] by 204.127.197.111; Sat, 17 Sep 2005 20:24:21 +0000 From: ericblake@comcast.net (Eric Blake) To: "J. Grant" , ams@gnu.org Date: Sat, 17 Sep 2005 20:24:21 +0000 Message-Id: <091720052024.1462.432C7B7500096FA1000005B622073000330A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 20:26:58 -0000 > > My point is for consistency, it is unclear what the strategy is with -h > in GNU tools, perhaps only a partial idea to use -h for help in some tools. > > -h has ended up being used for other purposes than help in GNU tools. > The fact remains that -h is often used for help in GNU tools, but not in > all cases. So I think GNU tools should be consistant, be that in having > a -h option for help, or not using -h option for help in some GNU tools. There are some tools where POSIX requires that -h stand for something that is not --help, so consistency argues that `--help' be the choice for all GNU tools to support. > > If the strategy is actually to only have --help, perhaps GNU should > define that somehwere, as obviously at present many GNU tools are > supporting the -h option for help. Then you haven't read section 4.6 of the GNU Coding Standards, that do just that: http://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html Also, section 4.7 mentions common long options, and their short option equivalents where appropriate, and neither --help nor --version are given a short option listing in the GCS. -- Eric Blake From MAILER-DAEMON Sat Sep 17 16:30:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EGjKq-0005QX-Pk for mharc-bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:30:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGjKo-0005Pu-Mh for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:30:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGjKm-0005P0-DX for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:30:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGjKm-0005Oe-8Z for bug-coreutils@gnu.org; Sat, 17 Sep 2005 16:30:52 -0400 Received: from [195.135.220.2] (helo=mx1.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EGjJ8-0001Zw-2G; Sat, 17 Sep 2005 16:29:10 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id B04D5E675; Sat, 17 Sep 2005 22:29:07 +0200 (CEST) From: Andreas Schwab To: "J. Grant" References: <432C32C6.8030807@jguk.org> <1126973045.125710.27102.nullmailer@Update.UU.SE> <432C484C.5040303@jguk.org> <1126978275.107157.27246.nullmailer@Update.UU.SE> <432C5BE4.7000104@jguk.org> <1126983718.105545.27373.nullmailer@Update.UU.SE> <432C6E1C.3000801@jguk.org> X-Yow: I love ROCK 'N ROLL! I memorized the all WORDS to ``WIPE-OUT'' in 1965!! Date: Sat, 17 Sep 2005 22:29:07 +0200 In-Reply-To: <432C6E1C.3000801@jguk.org> (J. Grant's message of "Sat, 17 Sep 2005 20:27:24 +0100") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: [Fwd: cat: invalid option -- h] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 20:30:55 -0000 "J. Grant" writes: > My point is for consistency, it is unclear what the strategy is with -h= =20 > in GNU tools, perhaps only a partial idea to use -h for help in some to= ols. > > -h has ended up being used for other purposes than help in GNU tools. If Unix had any tradition for -h being used for invoking help it wouldn't have been used for other things in commands like pr or file or chown or chgrp. None of these uses are GNU inventions. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From MAILER-DAEMON Mon Sep 19 01:09:40 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHDuN-0008B8-Ul for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 01:09:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHDoy-0005y8-L7 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 01:04:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHDot-0005wJ-L2 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 01:04:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHDot-0005w8-1I for bug-coreutils@gnu.org; Mon, 19 Sep 2005 01:03:59 -0400 Received: from [204.127.198.39] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHDop-00053S-1o for bug-coreutils@gnu.org; Mon, 19 Sep 2005 01:03:55 -0400 Received: from customer.comcast.net (c-66-41-246-241.hsd1.mn.comcast.net[66.41.246.241](misconfigured sender)) by comcast.net (rwcrmhc13) with ESMTP id <2005091905031601500nvclte>; Mon, 19 Sep 2005 05:03:16 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by odin.pftclub.com (Postfix) with ESMTP id DEDAF4836B for ; Mon, 19 Sep 2005 00:03:15 -0500 (CDT) Date: Mon, 19 Sep 2005 00:03:15 -0500 (CDT) From: Chris Oxenreider X-X-Sender: oxenreid@odin.pftclub.com To: bug-coreutils@gnu.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Mon, 19 Sep 2005 01:09:38 -0400 Subject: Feature request(s) df and ls/dir X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: oxenreid@state.net List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 05:04:06 -0000 Hi, I know this is the wrong forum for this, but I could not find a more appropriate e-mail address to send this too. I have two things I would like to see. In no particular order: I would like to se ls/dir report 'megabytes' much like the feature in 'du -m' or 'df -m' does. I would also like to see 'df' add line feeds in when reporting space in long device names such as Linux LVMs. Example: Current Behavior 'df -m': Filesystem 1M-blocks Used Available Use% Mounted on /dev/mapper/vg00-lv00 4961 3153 1554 67% / /dev/sda1 99 15 80 15% /boot /dev/shm 252 0 252 0% /dev/shm /dev/mapper/vg00-lv02 992 136 805 15% /usr/local /dev/mapper/vg00-lv03 3024 1420 1451 50% /home /dev/mapper/vg01-lv00 4568 3800 536 88% /tmp /dev/sdc1 34179 23489 10691 69% /export Proposed Behavior of 'df -m': Filesystem 1M-blocks Used Available Use% Mounted on /dev/mapper/vg00-lv00 4961 3153 1554 67% / /dev/sda1 99 15 80 15% /boot /dev/shm 252 0 252 0% /dev/shm /dev/mapper/vg00-lv02 992 136 805 15% /usr/local /dev/mapper/vg00-lv03 3024 1420 1451 50% /home /dev/mapper/vg01-lv00 4568 3800 536 88% /tmp /dev/sdc1 34179 23489 10691 69% /export You could implement this with a '-d' option which would not report the 'device' that was mounted like: Total 1M-blocks Used Available Use% Mounted on 4961 3153 1554 67% / 99 15 80 15% /boot 252 0 252 0% /dev/shm 992 136 805 15% /usr/local 3024 1420 1451 50% /home 4568 3800 536 88% /tmp 34179 23489 10691 69% /export -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Christopher G. Oxenreider | Die Gedanken Sind Frei chris.oxenreider@state.net | -- Deutsches Volkslied #include | http://babelfish.altavista.com/tr Copyright | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From MAILER-DAEMON Mon Sep 19 04:58:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHHTO-0004Ir-J4 for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:58:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHHSq-0004CK-HM for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:57:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHHSg-0004BJ-Pf for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:57:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHHSe-00049G-M7 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:57:16 -0400 Received: from [80.68.81.132] (helo=bigben2.bytemark.co.uk) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EHHRH-0004RR-O2 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:55:51 -0400 Received: from excession.spiral-arm.org ([80.68.89.77]) by bigben2.bytemark.co.uk with esmtp (Exim 4.52) id 1EHHRG-0008SH-5T for bug-coreutils@gnu.org; Mon, 19 Sep 2005 09:55:50 +0100 Received: by excession.spiral-arm.org (Postfix, from userid 1000) id 6A4EA82C4; Mon, 19 Sep 2005 10:05:45 +0100 (BST) Date: Mon, 19 Sep 2005 10:05:45 +0100 From: James Youngman To: Chris Oxenreider Message-ID: <20050919090545.GB2965@excession.spiral-arm.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: bug-coreutils@gnu.org Subject: Re: Feature request(s) df and ls/dir X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 08:57:56 -0000 On Mon, Sep 19, 2005 at 12:03:15AM -0500, Chris Oxenreider wrote: > I know this is the wrong forum for this, but I could not find a more > appropriate e-mail address to send this too. No, this is the right forum. > I have two things I would like to see. In no particular order: > > I would like to se ls/dir report 'megabytes' much like the feature in > 'du -m' or 'df -m' does. How exactly would this differ from ls -lh ls -s --block-size=1M ls -l --block-size=1M > I would also like to see 'df' add line feeds in when reporting space in > long device names such as Linux LVMs. The df program already does this by default I think. Are you asking for a behaviour where df *avoids* doing this? How is this different from df -PB 1M df -Ph Regards, James. From MAILER-DAEMON Mon Sep 19 05:13:30 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHHhA-0005b5-AV for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 05:12:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHHgs-0005Zk-LW for bug-coreutils@gnu.org; Mon, 19 Sep 2005 05:12:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHHUf-0004Xr-Bv for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:59:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHHTm-00049G-OK for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:58:28 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHHP1-0004Iz-9M for bug-coreutils@gnu.org; Mon, 19 Sep 2005 04:53:31 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id F06B6234; Mon, 19 Sep 2005 10:53:29 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14353; Mon, 19 Sep 05 10:53:24 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id A09861E4; Mon, 19 Sep 2005 10:53:24 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 6B8C144006; Mon, 19 Sep 2005 10:53:24 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08404-02-8; Mon, 19 Sep 2005 10:53:23 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id CF87B44005; Mon, 19 Sep 2005 10:53:23 +0200 (CEST) Received: (nullmailer pid 1849 invoked by uid 30270); Mon, 19 Sep 2005 08:53:23 -0000 From: "Alfred M\. Szmidt" To: oxenreid@state.net In-reply-to: (message from Chris Oxenreider on Mon, 19 Sep 2005 00:03:15 -0500 (CDT)) References: Date: Mon, 19 Sep 2005 10:53:23 +0200 Message-Id: <1127120003.695705.1848.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: Feature request(s) df and ls/dir X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 09:12:03 -0000 I would like to se ls/dir report 'megabytes' much like the feature in 'du -m' or 'df -m' does. ls already does that to some extent, see the --human-readable option. I would also like to see 'df' add line feeds in when reporting space in long device names such as Linux LVMs. You can use sed/awk for this. You could implement this with a '-d' option which would not report the 'device' that was mounted like: Same here, sed/awk. From MAILER-DAEMON Mon Sep 19 11:14:43 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHNLv-0002T1-5M for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 11:14:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHNLk-0002Q9-5J for bug-coreutils@gnu.org; Mon, 19 Sep 2005 11:14:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHNLf-0002O3-7L for bug-coreutils@gnu.org; Mon, 19 Sep 2005 11:14:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHNLe-0002LE-I4 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 11:14:26 -0400 Received: from [63.240.76.49] (helo=sccrmhc14.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHNJI-0002h4-2R; Mon, 19 Sep 2005 11:12:00 -0400 Received: from customer.comcast.net (c-66-41-246-241.hsd1.mn.comcast.net[66.41.246.241](misconfigured sender)) by comcast.net (sccrmhc14) with ESMTP id <2005091915115901400jtchqe>; Mon, 19 Sep 2005 15:11:59 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by odin.pftclub.com (Postfix) with ESMTP id 95DFD4836B; Mon, 19 Sep 2005 10:11:58 -0500 (CDT) Date: Mon, 19 Sep 2005 10:11:58 -0500 (CDT) From: Chris Oxenreider X-X-Sender: oxenreid@odin.pftclub.com To: James Youngman In-Reply-To: <20050919090545.GB2965@excession.spiral-arm.org> Message-ID: References: <20050919090545.GB2965@excession.spiral-arm.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: bug-coreutils@gnu.org Subject: Re: Feature request(s) df and ls/dir X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: oxenreid@state.net List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 15:14:33 -0000 On Mon, 19 Sep 2005, James Youngman wrote: > On Mon, Sep 19, 2005 at 12:03:15AM -0500, Chris Oxenreider wrote: > >> I have two things I would like to see. In no particular order: >> >> I would like to se ls/dir report 'megabytes' much like the feature in >> 'du -m' or 'df -m' does. > > How exactly would this differ from > ls -lh > ls -s --block-size=1M > ls -l --block-size=1M It doesn't. Thanks! >> I would also like to see 'df' add line feeds in when reporting space in >> long device names such as Linux LVMs. > > The df program already does this by default I think. Are you asking > for a behaviour where df *avoids* doing this? Yes, I meant to say 'not add line feeds'. > How is this different from > df -PB 1M > df -Ph Other than the man page not saying what 'Posix' means (IE no line feeds) and the loss of column alignment, not much. Thanks. My brain was not quite functioning so well at 3am when I was writing the requests. After messing with large logical volumes (aix and Linux) and SAN disks et all I was looking for ways to cut down on the amount of stuff I needed to read and comprehend. Thanks for the help. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Christopher G. Oxenreider | Die Gedanken Sind Frei chris.oxenreider@state.net | -- Deutsches Volkslied #include | http://babelfish.altavista.com/tr Copyright | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From MAILER-DAEMON Mon Sep 19 18:40:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHUJP-0007rF-8r for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 18:40:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHPS1-0006UZ-M2 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 13:29:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHPRw-0006SL-RG for bug-coreutils@gnu.org; Mon, 19 Sep 2005 13:29:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHPRw-0006QK-3J for bug-coreutils@gnu.org; Mon, 19 Sep 2005 13:29:04 -0400 Received: from [195.135.220.15] (helo=mx2.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EHPPV-00067U-Ru for bug-coreutils@gnu.org; Mon, 19 Sep 2005 13:26:34 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 5063F1C7BE for ; Mon, 19 Sep 2005 19:26:31 +0200 (CEST) Date: Mon, 19 Sep 2005 19:26:30 +0200 From: Juergen Weigert To: bug-coreutils@gnu.org Message-ID: <20050919172630.GV2965@suse.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ylS2wUBXLOxYXZFQ" Content-Disposition: inline X-Mailman-Approved-At: Mon, 19 Sep 2005 18:40:34 -0400 Subject: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 17:29:11 -0000 --ylS2wUBXLOxYXZFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi coreutils people! On a recent SUSE Linux df became unreliable for e.g. USB-drives. This is because hald automatically mounts and unmounts such drives as they are accessed. Usually I get something like: $ df /media/USB_DISK Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 0 0 0 - /media/USB_DISK only if the USB_DISK is being accessed, I get the expected output. $ ls /media/USB_DISK > /dev/null; df /media/USB_DISK Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 252522 238718 13804 95% /media/USB_DISK A simple enhancement for df is to actively access the USB_DISK while running statfs(). I've added an opendir() call in the attached patch. This can be suppressed with a new commandline option -n. Please keep me in CC, I am not subscribed. thanks, Jw. -- o \ Juergen Weigert paint it green! __/ _=======.=======_ | jw@suse.de wide open suse_/ _---|____________\/ \ | 0911 74053-508 (tm)__/ (____/ /\ (/) | __________________________/ _/ \_ vim:set sw=2 wm=8 --ylS2wUBXLOxYXZFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="coreutils-cvs-df-media-mount.diff" --- ./doc/coreutils.texi.orig 2005-09-17 09:44:42.000000000 +0200 +++ ./doc/coreutils.texi 2005-09-19 19:08:54.528587971 +0200 @@ -8763,6 +8763,16 @@ Limit the listing to local file systems. By default, remote file systems are also listed. +@item -n +@itemx --no-mount +@opindex -n +@opindex --no-mount +@cindex file system space, retriving output from removable media +Per default, a mountpoint that reports 0 blocks, will be opended via @code{opendir} +and a second attempt will be made to report the stats. This trick usually monts the +device, if it is a removable media. +This option prevents this mount attempt and reports 0 blocks in that case. + @item --no-sync @opindex --no-sync @cindex file system space, retrieving old data more quickly --- ./src/df.c.orig 2005-08-16 22:33:40.000000000 +0200 +++ ./src/df.c 2005-09-19 19:08:05.492105049 +0200 @@ -24,6 +24,7 @@ #include #include #include +#include #include "system.h" #include "canonicalize.h" @@ -69,6 +70,9 @@ /* If true, use the POSIX output format. */ static bool posix_format; +/* If true, use opendir to attempt a mount if blocks would be 0. */ +static bool no_mount_attempt; + /* If true, invoke the `sync' system call before getting any usage data. Using this option can make df very slow, especially with many or very busy disks. Note that this may make a difference on some systems -- @@ -128,6 +132,7 @@ {"kilobytes", no_argument, NULL, 'k'}, /* long form is obsolescent */ {"local", no_argument, NULL, 'l'}, {"megabytes", no_argument, NULL, 'm'}, /* obsolescent */ + {"no-mount", no_argument, NULL, 'n'}, {"portability", no_argument, NULL, 'P'}, {"print-type", no_argument, NULL, 'T'}, {"sync", no_argument, NULL, SYNC_OPTION}, @@ -305,6 +310,20 @@ return; } + if (!no_mount_attempt && fsu.fsu_blocks == 0) + { + DIR *d = NULL; + d = opendir(stat_file); + if (get_fs_usage (stat_file, disk, &fsu)) + { + if (d) closedir(d); + error (0, errno, "%s", quote (stat_file)); + exit_status = EXIT_FAILURE; + return; + } + if (d) closedir(d); + } + if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs) return; @@ -732,6 +751,7 @@ -k like --block-size=1K\n\ -l, --local limit listing to local file systems\n\ --no-sync do not invoke sync before getting usage info (default)\n\ + -n, --no-mount do not attempt to mount removable media\n\ "), stdout); fputs (_("\ -P, --portability use the POSIX output format\n\ @@ -772,6 +792,7 @@ inode_format = false; show_all_fs = false; show_listed_fs = false; + no_mount_attempt = false; human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, &output_block_size); @@ -780,7 +801,7 @@ posix_format = false; exit_status = EXIT_SUCCESS; - while ((c = getopt_long (argc, argv, "aB:iF:hHklmPTt:vx:", long_options, NULL)) + while ((c = getopt_long (argc, argv, "aB:iF:hHklmnPTt:vx:", long_options, NULL)) != -1) { switch (c) @@ -813,6 +834,9 @@ human_output_opts = 0; output_block_size = 1024 * 1024; break; + case 'n': + no_mount_attempt = true; + break; case 'T': print_type = true; break; --ylS2wUBXLOxYXZFQ-- From MAILER-DAEMON Mon Sep 19 18:40:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHUJP-0007rH-DA for mharc-bug-coreutils@gnu.org; Mon, 19 Sep 2005 18:40:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHQ7a-0006DO-Mt for bug-coreutils@gnu.org; Mon, 19 Sep 2005 14:12:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHQ7X-0006CA-Ur for bug-coreutils@gnu.org; Mon, 19 Sep 2005 14:12:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHQ7X-00067g-Cs for bug-coreutils@gnu.org; Mon, 19 Sep 2005 14:12:03 -0400 Received: from [195.135.220.15] (helo=mx2.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EHQ51-0001nO-T1 for bug-coreutils@gnu.org; Mon, 19 Sep 2005 14:09:28 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 716531CA39 for ; Mon, 19 Sep 2005 20:09:26 +0200 (CEST) Date: Mon, 19 Sep 2005 20:09:25 +0200 From: Juergen Weigert To: bug-coreutils@gnu.org Message-ID: <20050919180925.GW2965@suse.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BQPnanjtCNWHyqYD" Content-Disposition: inline X-Mailman-Approved-At: Mon, 19 Sep 2005 18:40:34 -0400 Subject: date misbehaves with illegal timezones X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 18:12:11 -0000 --BQPnanjtCNWHyqYD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi coreutils people! Guessing timezones with date is dangerous. What is the time in the US, say, Mountain area? $ env TZ=US/Mountain date Mon Sep 19 11:51:28 MDT 2005 --> correct. $ env TZ=MST date Mon Sep 19 10:51:58 MST 2005 --> correct. Aha, difference between MDT and MST is one hour. Let us check that with the abbreviated name, as seen above: $ env TZ=MDT date Mon Sep 19 17:52:53 MDT 2005 --> wrong. Oops, now difference is 7 hours ... The problem here is, that MDT is an unknown timezone on my machine. Date silently defaults back to GMT, but it keeps the label 'MDT'. The first bug here may be that env TZ=US/Mountain date prints a timezone name that it cannot use as its own input. I don't want to fix that now. The second and IMHO more serious bug is that invalid input is not recognized as such, and thus very misleading output is generated. Please find attached a trivial patch that checks for unknown timezones and prints a warning. I should also change the printed label in that case, but I don't see an easy way to do that. thanks, Jw. -- o \ Juergen Weigert paint it green! __/ _=======.=======_ | jw@suse.de wide open suse_/ _---|____________\/ \ | 0911 74053-508 (tm)__/ (____/ /\ (/) | __________________________/ _/ \_ vim:set sw=2 wm=8 --BQPnanjtCNWHyqYD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="coreutils-cvs-date-tzname-check.diff" --- ./coreutils/src/date.c.orig 2005-09-16 10:08:00.000000000 +0200 +++ ./coreutils/src/date.c 2005-09-19 19:02:30.378609502 +0200 @@ -271,6 +271,15 @@ } } +#ifdef HAVE_TZSET + /* Cannot use HAVE_TZNAME here. sigh, jw@suse.de */ + extern char *tzname[2]; + if (!tzname[1][0]) + { + error (0, 0, _("invalid timezone %s, using default"), tzname[0]); + } +#endif + line = NULL; buflen = 0; ok = true; --BQPnanjtCNWHyqYD-- From MAILER-DAEMON Tue Sep 20 09:13:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHhwR-0005xc-0o for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:13:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHgjO-0006yj-Q6 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 07:56:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHgjK-0006xX-Q7 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 07:56:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHgjK-0006vV-77 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 07:56:10 -0400 Received: from [152.81.9.195] (helo=dixsept.loria.fr) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EHgeF-0003Sn-QD for bug-coreutils@gnu.org; Tue, 20 Sep 2005 07:50:55 -0400 Received: from vlefevre by dixsept.loria.fr with local (Exim 4.52) id 1EHgeB-0002PM-OO; Tue, 20 Sep 2005 13:50:51 +0200 Date: Tue, 20 Sep 2005 13:50:51 +0200 From: Vincent Lefevre To: bug-coreutils@gnu.org Message-ID: <20050920115051.GN11116@dixsept.loria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.10-vl-20050905i X-Mailman-Approved-At: Tue, 20 Sep 2005 09:13:42 -0400 Subject: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 11:56:18 -0000 dixsept:~> _POSIX2_VERSION=200111 head -1 /dev/null dixsept:~> _POSIX2_VERSION=200112 head -1 /dev/null head: `-1' option is obsolete; use `-n 1' Try `head --help' for more information. zsh: exit 1 _POSIX2_VERSION=200112 head -1 /dev/null I do not think this is a good idea to fail on the old form, as it is still useful, at least with an interactive shell. As said by the POSIX FAQ Q15, POSIX does not disallow this form: http://www.opengroup.org/austin/papers/posix_faq.html Q15. Does removal of obsolescent utility syntax mean that implementations supporting usages of head -5 file, tail -5 file, tail -l file are no longer allowed? No, in general the intent of removing the obsolescent forms of the utility synopses was not to disallow them to be supported by implementations but to downgrade the status of their use in applications from conforming application using an obsolescent feature to non-conforming application. In general it is allowed for utilities to have extensions that violate the utility syntax guidelines so long as the forms defined in the standard that are required to follow the utility syntax guidelines do so. The cases cited fit the case. The Austin Group has more general cases under review at the present time. I would not be against an environment variable to restrict to POSIX options only (for testing purpose and things like that), but in this case, the coreutils should be consistent and disallow the -c option too, as it is not described by POSIX: http://www.opengroup.org/onlinepubs/009695399/utilities/head.html (see the rationale). -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / SPACES project at LORIA From MAILER-DAEMON Tue Sep 20 09:13:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHhwT-0005xq-Ld for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:13:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHhkj-0000yn-G5 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:01:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHhkg-0000xW-Op for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:01:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHhkg-0000rZ-G3 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:01:38 -0400 Received: from [193.69.113.81] (helo=sam.opera.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EHhhT-0008Fo-GB for bug-coreutils@gnu.org; Tue, 20 Sep 2005 08:58:19 -0400 Received: from localhost.localdomain (pat.opera.com [193.69.113.22]) by sam.opera.com (8.12.3/8.12.3/Debian-7.1) with ESMTP id j8KCw098021714 for ; Tue, 20 Sep 2005 12:58:00 GMT To: bug-coreutils@gnu.org From: "Till Halbach" Organization: Opera Software Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Tue, 20 Sep 2005 14:58:04 +0200 Message-ID: User-Agent: Opera M2/8.50 (Linux, build 1358) X-Scanned-By: MIMEDefang 2.39 X-Mailman-Approved-At: Tue, 20 Sep 2005 09:13:43 -0400 Subject: No action with forced symbolic link if link already exists X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:01:42 -0000 Grettings: I'm running ln (coreutils) 5.2.1. Assume the link "link" already exists and points to "other_file". Then "ln -sf new_file link" won't trigger any action at all. No error message is uttered either. This is a regression, as it worked before (i.e., the old link was overwritten). Unfortunately I cannot tell exactly where it was introduced. HTH. -- Till Halbach From MAILER-DAEMON Tue Sep 20 09:45:27 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHiR3-0008Jm-Te for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:45:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHiR0-0008HR-AN for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:45:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHiQx-0008Fs-Je for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:45:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHiP5-0007No-Em for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:43:23 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHi44-0001w6-8h for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:21:40 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 8D5C2EF7; Tue, 20 Sep 2005 15:21:38 +0200 (CEST) From: Jim Meyering To: Vincent Lefevre In-Reply-To: <20050920115051.GN11116@dixsept.loria.fr> (Vincent Lefevre's message of "Tue, 20 Sep 2005 13:50:51 +0200") References: <20050920115051.GN11116@dixsept.loria.fr> Date: Tue, 20 Sep 2005 15:21:38 +0200 Message-ID: <87oe6nq3h9.fsf@rho.meyering.net> Lines: 13 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:45:24 -0000 Vincent Lefevre wrote: > dixsept:~> _POSIX2_VERSION=200111 head -1 /dev/null > dixsept:~> _POSIX2_VERSION=200112 head -1 /dev/null > head: `-1' option is obsolete; use `-n 1' > Try `head --help' for more information. > zsh: exit 1 _POSIX2_VERSION=200112 head -1 /dev/null > > I do not think this is a good idea to fail on the old form, as > it is still useful, at least with an interactive shell. As said > by the POSIX FAQ Q15, POSIX does not disallow this form: The POSIX spec is a moving target. This has been fixed in the latest sources (available via cvs). From MAILER-DAEMON Tue Sep 20 09:46:32 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHiS8-0000W7-Do for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHiS6-0000V6-Ls for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHiS2-0000TG-SN for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHiOg-0007No-Qq for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:42:58 -0400 Received: from [204.127.198.35] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHiBR-0002XG-0Z for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:29:17 -0400 Received: from 204.127.197.119 (rmailcenter79.comcast.net[204.127.197.179]) by comcast.net (rwcrmhc11) with SMTP id <2005092013290801300h3ofee>; Tue, 20 Sep 2005 13:29:14 +0000 Received: from [128.170.36.44] by 204.127.197.119; Tue, 20 Sep 2005 13:29:08 +0000 From: ericblake@comcast.net (Eric Blake) To: Vincent Lefevre , bug-coreutils@gnu.org Date: Tue, 20 Sep 2005 13:29:08 +0000 Message-Id: <092020051329.29107.43300EA400005C40000071B322007610640A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: Subject: Re: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:46:31 -0000 > dixsept:~> _POSIX2_VERSION=200111 head -1 /dev/null > dixsept:~> _POSIX2_VERSION=200112 head -1 /dev/null > head: `-1' option is obsolete; use `-n 1' > Try `head --help' for more information. > zsh: exit 1 _POSIX2_VERSION=200112 head -1 /dev/null > > I do not think this is a good idea to fail on the old form, as > it is still useful, at least with an interactive shell. This behavior has been changed in CVS coreutils. Whenever 5.3.1 is released, _POSIX2_VERSION=200112 head -1 will do what you are asking for. However, portable scripts cannot rely on this behavior, as it is no longer mandated by POSIX (and, as you note, released versions of coreutils reject it), so you may want to consider fixing your scripts to be portable anyway. -- Eric Blake From MAILER-DAEMON Tue Sep 20 09:46:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHiSO-0000gP-DO for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHiSJ-0000df-5q for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHiOg-0007Xu-8E for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:43:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHiOf-0007No-CP for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:42:57 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHiBm-0002YU-5k for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:29:38 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 9BCE6EF7; Tue, 20 Sep 2005 15:29:36 +0200 (CEST) From: Jim Meyering To: "Till Halbach" In-Reply-To: (Till Halbach's message of "Tue, 20 Sep 2005 14:58:04 +0200") References: Date: Tue, 20 Sep 2005 15:29:36 +0200 Message-ID: <87irwvq33z.fsf@rho.meyering.net> Lines: 11 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: No action with forced symbolic link if link already exists X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:46:45 -0000 "Till Halbach" wrote: > Assume the link "link" already exists and points to "other_file". Then > "ln -sf new_file link" won't trigger any action at all. No error message > is uttered either. > This is a regression, as it worked before (i.e., the old link was > overwritten). > Unfortunately I cannot tell exactly where it was introduced. Thanks for the report, but I can't reproduce that, unless other_file is a directory. Please tell us the precise commands you used and show what happens. From MAILER-DAEMON Tue Sep 20 09:47:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHiS1-0000SW-Ol for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:46:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHiOo-0007Zx-KG for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:43:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHiOW-0007Qs-GY for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:42:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHiOU-0007No-9Z for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:42:46 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHiLP-00037x-P6 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:39:36 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 43B694B2E8; Tue, 20 Sep 2005 07:39:34 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 34F471360A6; Tue, 20 Sep 2005 07:39:34 -0600 (MDT) Date: Tue, 20 Sep 2005 07:39:34 -0600 To: Till Halbach Message-ID: <20050920133934.GA23119@dementia.proulx.com> Mail-Followup-To: Till Halbach , bug-coreutils@gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: No action with forced symbolic link if link already exists X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:46:20 -0000 Till Halbach wrote: > I'm running > ln (coreutils) 5.2.1. > > Assume the link "link" already exists and points to "other_file". Then > "ln -sf new_file link" won't trigger any action at all. No error message > is uttered either. I will guess that you are only seeing this when link points to a directory and not to a file. Because then the new symlink will be created in the directory. If you look at the symlink you may be fooled into thinking nothing happened. But I am sure the symlink was created. Try using the --verbose option and you should see exactly what is happening. ln -v -sf new_file link > This is a regression, as it worked before (i.e., the old link was > overwritten). > Unfortunately I cannot tell exactly where it was introduced. You may find these previous discussions useful. http://lists.gnu.org/archive/html/bug-fileutils/2003-10/msg00001.html And more recently. http://lists.gnu.org/archive/html/bug-coreutils/2005-05/msg00171.html This is BSD style functionality. You are probably wanting SysV style functionality. The only portable way to do this is to remove the symlink first. rm -f dstfile ln -s srcfile dstfile Also best to remove the slash from the value of the link. As an extension but something that won't work on legacy SysV like systems such as HP-UX or AIX you can use the -n option. ln -fns srcfile dstfile Bob From MAILER-DAEMON Tue Sep 20 09:56:00 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHibH-0007Ly-9u for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHibB-0007In-Ea for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHib8-0007H7-D6 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHib7-0007Da-PJ for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:49 -0400 Received: from [204.127.198.43] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHiZx-0004xt-VV for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:54:38 -0400 Received: from 204.127.197.111 ([204.127.197.111]) by comcast.net (rwcrmhc12) with SMTP id <20050920135435014000utame>; Tue, 20 Sep 2005 13:54:36 +0000 Received: from [128.170.36.44] by 204.127.197.111; Tue, 20 Sep 2005 13:54:34 +0000 From: ericblake@comcast.net (Eric Blake) To: Jim Meyering Date: Tue, 20 Sep 2005 13:54:34 +0000 Message-Id: <092020051354.3110.4330149A000A2EE500000C2622007374780A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:55:57 -0000 > > The POSIX spec is a moving target. > This has been fixed in the latest sources (available via cvs). There have been quite a few changes since 5.3.0 in January. Is it time to make a 5.3.1 release, so we can point people to a release instead of CVS? -- Eric Blake From MAILER-DAEMON Tue Sep 20 09:56:03 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHibL-0007Nc-4k for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:56:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHibH-0007Lk-54 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHibD-0007Ju-7X for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHibB-0007Da-Mk for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:54 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHibA-0005Ac-CH for bug-coreutils@gnu.org; Tue, 20 Sep 2005 09:55:52 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id A3672EF7; Tue, 20 Sep 2005 15:55:50 +0200 (CEST) From: Jim Meyering To: ericblake@comcast.net (Eric Blake) In-Reply-To: <092020051354.3110.4330149A000A2EE500000C2622007374780A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Tue, 20 Sep 2005 13:54:34 +0000") References: <092020051354.3110.4330149A000A2EE500000C2622007374780A050E040D0C079D0A@comcast.net> Date: Tue, 20 Sep 2005 15:55:50 +0200 Message-ID: <87d5n3q1w9.fsf@rho.meyering.net> Lines: 6 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 13:56:00 -0000 ericblake@comcast.net (Eric Blake) wrote: > There have been quite a few changes since 5.3.0 in January. > Is it time to make a 5.3.1 release, so we can point people > to a release instead of CVS? Yes. I'm planning to make a test release very soon. From MAILER-DAEMON Tue Sep 20 13:28:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHlvN-0004WF-1V for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 13:28:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHlvH-0004SL-Jr for bug-coreutils@gnu.org; Tue, 20 Sep 2005 13:28:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHlvB-0004N0-0N for bug-coreutils@gnu.org; Tue, 20 Sep 2005 13:28:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHlvA-0004Lq-P2 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 13:28:44 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHlso-0004bV-8j for bug-coreutils@gnu.org; Tue, 20 Sep 2005 13:26:18 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8KHQF412675; Tue, 20 Sep 2005 10:26:15 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EHlsl-0006DL-AZ; Tue, 20 Sep 2005 10:26:15 -0700 To: Vincent Lefevre References: <20050920115051.GN11116@dixsept.loria.fr> From: Paul Eggert Date: Tue, 20 Sep 2005 10:26:15 -0700 In-Reply-To: <20050920115051.GN11116@dixsept.loria.fr> (Vincent Lefevre's message of "Tue, 20 Sep 2005 13:50:51 +0200") Message-ID: <87br2n1wi0.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: head -1 fails with _POSIX2_VERSION=200112 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 17:28:52 -0000 Vincent Lefevre writes: > As said by the POSIX FAQ Q15, POSIX does not disallow this form: > > http://www.opengroup.org/austin/papers/posix_faq.html Yes, and coreutils CVS was updated about the same time that FAQ Q15 was written -- it was all part of the same process of clarifying and revising this area POSIX. As I understand it the POSIX spec is also planned to be formally updated in a future version. Unfortunately the current POSIX spec and the current stable coreutils have been out for a while. I suggest 'sed 1q' as a portable alternative to 'head -1', since by all accounts even the revised (future) POSIX spec will not require support for 'head -1'. (Also, "sed 1q" is a bit easier to type. :-) From MAILER-DAEMON Tue Sep 20 15:21:31 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHngJ-0000Of-Nb for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 15:21:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHnd0-0007kR-3d for bug-coreutils@gnu.org; Tue, 20 Sep 2005 15:18:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHnct-0007g1-LH for bug-coreutils@gnu.org; Tue, 20 Sep 2005 15:18:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHncp-0007Wg-Gi for bug-coreutils@gnu.org; Tue, 20 Sep 2005 15:17:55 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHnUI-0000TS-6m for bug-coreutils@gnu.org; Tue, 20 Sep 2005 15:09:06 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8KJ92424030; Tue, 20 Sep 2005 12:09:02 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EHnUE-0006Gu-A1; Tue, 20 Sep 2005 12:09:02 -0700 To: Juergen Weigert References: <20050919180925.GW2965@suse.de> From: Paul Eggert Date: Tue, 20 Sep 2005 12:09:02 -0700 In-Reply-To: <20050919180925.GW2965@suse.de> (Juergen Weigert's message of "Mon, 19 Sep 2005 20:09:25 +0200") Message-ID: <87oe6nzhdd.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: date misbehaves with illegal timezones X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 19:21:29 -0000 Juergen Weigert writes: > $ env TZ=MDT date > Mon Sep 19 17:52:53 MDT 2005 > --> wrong. > > Oops, now difference is 7 hours ... > The problem here is, that MDT is an unknown timezone on my machine. > Date silently defaults back to GMT, but it keeps the label 'MDT'. "date" is merely outputting the time zone information given by the localtime function of the C library, so the behavior you're observing is a property of the C library, not of coreutils. For example, on Solaris 10 with coreutils 5.3.0, we get this: $ TZ=MDT date Tue Sep 20 18:59:58 GMT 2005 > The first bug here may be that env TZ=US/Mountain date prints a timezone > name that it cannot use as its own input. That's not a bug, since strftime's %Z format isn't supposed to output a time zone abbreviation that is acceptable as a TZ value. It would be impossible for it to do so in general; for example, the abbreviation "EST" has different meanings in Australia and the US. > The second and IMHO more serious bug is that invalid input is not > recognized as such, and thus very misleading output is generated. I agree that it's a problem, but this is a C library issue, not a coreutils issue, so it's a matter that would need to be taken up with the GNU C library. It's longstanding tradition that invalid TZ values act like UTC, so I suspect at most you'll get a change to have strftime %Z output "GMT" (like Solaris 10) or "UTC" (probably better these days) rather than the TZ string value. From MAILER-DAEMON Tue Sep 20 16:25:41 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHogP-0006Wp-3X for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:25:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHof7-0005zX-PM for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:24:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHoex-0005tM-1c for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:24:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHoev-0005dd-Ta for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:24:10 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHoTy-0005KR-J2 for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:12:50 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8KKCk400607; Tue, 20 Sep 2005 13:12:47 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EHoTu-0004SP-LC; Tue, 20 Sep 2005 13:12:46 -0700 To: Juergen Weigert References: <20050919172630.GV2965@suse.de> From: Paul Eggert Date: Tue, 20 Sep 2005 13:12:46 -0700 In-Reply-To: <20050919172630.GV2965@suse.de> (Juergen Weigert's message of "Mon, 19 Sep 2005 19:26:30 +0200") Message-ID: <87hdcfzef5.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 20:25:39 -0000 Juergen Weigert writes: > On a recent SUSE Linux df became unreliable for e.g. USB-drives. > This is because hald automatically mounts and unmounts such drives > as they are accessed. > > Usually I get something like: > > $ df /media/USB_DISK > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/sda1 0 0 0 - /media/USB_DISK > > only if the USB_DISK is being accessed, I get the expected output. Thanks for reporting the issue. > A simple enhancement for df is to actively access the USB_DISK while running > statfs(). I've added an opendir() call in the attached patch. Wouldn't open() suffice? That would be simpler. Unless I'm missing something I'd rather not change the default behavor of df, as that would be a compatibility hassle. That is, df shouldn't attempt to mount file systems by default; it should do so only if the user asks, with a new option. Also, the main fix needs to be in fsusage.c, not df.c. If the new option is in effect, fsusage.c should attempt to open() the file, then use fstatfs on the result; it should fall back on statfs if the open fails. This will require a new boolean option to get_fs_usage, which asks it to use open/fstatfs rather than statfs (and similarly for the other hosts, e.g., use fstatvfs rather than statvfs). Finally, we'd need copyright papers from you to accept such a patch; I assume this is OK? From MAILER-DAEMON Tue Sep 20 17:02:52 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHp9g-0003it-KT for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:55:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHp9Y-0003ff-GB for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:55:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHp9M-0003Yk-Qf for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:55:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHp9M-0003YK-4V for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:55:36 -0400 Received: from [195.135.220.15] (helo=mx2.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EHp8Y-0008JR-8O for bug-coreutils@gnu.org; Tue, 20 Sep 2005 16:54:46 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 7A3261D806; Tue, 20 Sep 2005 22:54:39 +0200 (CEST) Date: Tue, 20 Sep 2005 22:54:38 +0200 From: Juergen Weigert To: Paul Eggert Message-ID: <20050920205438.GD2965@suse.de> References: <20050919172630.GV2965@suse.de> <87hdcfzef5.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87hdcfzef5.fsf@penguin.cs.ucla.edu> Cc: bug-coreutils@gnu.org Subject: Re: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2005 20:55:52 -0000 On Sep 20, 05 13:12:46 -0700, Paul Eggert wrote: > Juergen Weigert writes: > > > On a recent SUSE Linux df became unreliable for e.g. USB-drives. > > This is because hald automatically mounts and unmounts such drives > > as they are accessed. > > > > Usually I get something like: > > > > $ df /media/USB_DISK > > Filesystem 1K-blocks Used Available Use% Mounted on > > /dev/sda1 0 0 0 - /media/USB_DISK > > > > only if the USB_DISK is being accessed, I get the expected output. > > Thanks for reporting the issue. > > > A simple enhancement for df is to actively access the USB_DISK while running > > statfs(). I've added an opendir() call in the attached patch. > > Wouldn't open() suffice? That would be simpler. I chose opendir(), because I am not sure if all systems allow open() on a directory node. Otherwise I'd also favour open(), it has no issue with getting a header file for dirent/direct, or whatever the directory structure may be called. > Unless I'm missing something I'd rather not change the default behavor > of df, as that would be a compatibility hassle. That is, df shouldn't > attempt to mount file systems by default; it should do so only if the > user asks, with a new option. These hald mounts are different. For almost every aspect such a device appears to be mounted. So I figured, df should also pretend the device is mounted. > Also, the main fix needs to be in fsusage.c, not df.c. If the new > option is in effect, fsusage.c should attempt to open() the file, then > use fstatfs on the result; it should fall back on statfs if the open > fails. Looks ugly in df.c, right. But in fsusage.c we'd have to place the new code in multiple implementations. Ugly too. > This will require a new boolean option to get_fs_usage, which > asks it to use open/fstatfs rather than statfs (and similarly for the > other hosts, e.g., use fstatvfs rather than statvfs). > Finally, we'd need copyright papers from you to accept such a patch; > I assume this is OK? Sure. Is it sufficient to abondon copyright, or do you want to have it? thanks, Jw. -- o \ Juergen Weigert paint it green! __/ _=======.=======_ | jw@suse.de wide open suse_/ _---|____________\/ \ | 0911 74053-508 (tm)__/ (____/ /\ (/) | __________________________/ _/ \_ vim:set sw=2 wm=8 From MAILER-DAEMON Tue Sep 20 21:32:33 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHtTM-0006Yi-Of for mharc-bug-coreutils@gnu.org; Tue, 20 Sep 2005 21:32:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHtOp-0005Vf-HN for bug-coreutils@gnu.org; Tue, 20 Sep 2005 21:27:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHtOh-0005JX-6H for bug-coreutils@gnu.org; Tue, 20 Sep 2005 21:27:43 -0400 Received: from [132.239.55.107] (helo=gradlab.ucsd.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHtDi-0007Qf-VV for bug-coreutils@gnu.org; Tue, 20 Sep 2005 21:16:23 -0400 Received: from gradlab.ucsd.edu (localhost [127.0.0.1]) by gradlab.ucsd.edu (8.12.10/8.12.10) with ESMTP id j8L1GAup025404 for ; Tue, 20 Sep 2005 18:16:10 -0700 (PDT) Received: from localhost (scheckow@localhost) by gradlab.ucsd.edu (8.12.10/8.12.10/Submit) with ESMTP id j8L1G9rv025401 for ; Tue, 20 Sep 2005 18:16:09 -0700 (PDT) Date: Tue, 20 Sep 2005 18:16:09 -0700 (PDT) From: Stephen Checkoway To: bug-coreutils@gnu.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: milter-spamc/0.15.245 (gradlab.ucsd.edu [132.239.55.107]); pass=YES; Tue, 20 Sep 2005 18:16:21 -0700 X-Mailman-Approved-At: Tue, 20 Sep 2005 21:32:30 -0400 Subject: stty test fails X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 01:27:55 -0000 [gradlab:~/coreutils-5.2.1/tests/stty] scheckow$ uname -a SunOS gradlab.ucsd.edu 5.8 Generic_117350-02 sun4u sparc SUNW,Ultra-60 [gradlab:~/coreutils-5.2.1/tests/stty] scheckow$ make VERBOSE=yes TESTS=row-col-1 check make check-TESTS make[1]: Entering directory `/home/scheckow/coreutils-5.2.1/tests/stty' + stty --version stty (GNU coreutils) 5.2.1 Written by David MacKenzie. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. COLUMNS=80 + export COLUMNS + . ./../input-tty + tty -s + test -t 1 + test = no tests= 1 rows_40_columns_80 40_80 2 rows_0_columns_0 0_0 3 rows_40_columns_80 40_80 4 rows_0 0_80 5 columns_0 0_0 6 rows_40 40_0 7 rows_0 0_0 8 columns_80 0_80 9 rows_30 30_80 NA LAST NA + set - 1 rows_40_columns_80 40_80 2 rows_0_columns_0 0_0 3 rows_40_columns_80 40_80 4 rows_0 0_80 5 columns_0 0_0 6 rows_40 40_0 7 rows_0 0_0 8 columns_80 0_80 9 rows_30 30_80 NA LAST NA test 1... ok test 2... FAIL test 3... ok test 4... ok test 5... FAIL test 6... ok test 7... FAIL test 8... ok test 9... ok FAIL: row-col-1 ====================================== 1 of 1 tests failed Please report to bug-coreutils@gnu.org ====================================== make[1]: *** [check-TESTS] Error 1 make[1]: Leaving directory `/home/scheckow/coreutils-5.2.1/tests/stty' make: *** [check-am] Error 2 - Steve From MAILER-DAEMON Wed Sep 21 03:38:31 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EHzBJ-0004VF-Mb for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 03:38:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHz80-0003wL-I3 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 03:34:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHz6U-0003Y7-9M for bug-coreutils@gnu.org; Wed, 21 Sep 2005 03:33:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHz1C-0002g4-Na for bug-coreutils@gnu.org; Wed, 21 Sep 2005 03:27:51 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHytl-0003sK-6C for bug-coreutils@gnu.org; Wed, 21 Sep 2005 03:20:09 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id ED537109F; Wed, 21 Sep 2005 09:20:07 +0200 (CEST) From: Jim Meyering To: Stephen Checkoway In-Reply-To: (Stephen Checkoway's message of "Tue, 20 Sep 2005 18:16:09 -0700 (PDT)") References: Date: Wed, 21 Sep 2005 09:20:07 +0200 Message-ID: <87irwunazc.fsf@rho.meyering.net> Lines: 12 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: stty test fails X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 07:38:10 -0000 Stephen Checkoway wrote: > [gradlab:~/coreutils-5.2.1/tests/stty] scheckow$ uname -a > SunOS gradlab.ucsd.edu 5.8 Generic_117350-02 sun4u sparc SUNW,Ultra-60 Thanks for the report. Those are all minor test failures that have been fixed in the latest sources (available via CVS). They may also be fixed in this test release: ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.bz2 From MAILER-DAEMON Wed Sep 21 08:34:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EI3ne-00058a-1J for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 08:34:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EI3nX-00054p-93 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 08:34:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EI3nU-00053n-Oe for bug-coreutils@gnu.org; Wed, 21 Sep 2005 08:34:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EI3md-0004YD-JM for bug-coreutils@gnu.org; Wed, 21 Sep 2005 08:33:08 -0400 Received: from [63.240.76.21] (helo=sccrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EI3fk-0003OZ-Qm for bug-coreutils@gnu.org; Wed, 21 Sep 2005 08:26:01 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc11) with ESMTP id <2005092112255201100pdipue>; Wed, 21 Sep 2005 12:25:52 +0000 Message-ID: <4331514E.6080703@byu.net> Date: Wed, 21 Sep 2005 06:25:50 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Juergen Weigert References: <20050919172630.GV2965@suse.de> <87hdcfzef5.fsf@penguin.cs.ucla.edu> <20050920205438.GD2965@suse.de> In-Reply-To: <20050920205438.GD2965@suse.de> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Paul Eggert , bug-coreutils@gnu.org Subject: Re: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 12:34:05 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Juergen Weigert on 9/20/2005 2:54 PM: >>Wouldn't open() suffice? That would be simpler. > > > I chose opendir(), because I am not sure if all systems allow open() on a > directory node. Otherwise I'd also favour open(), it has no issue with > getting a header file for dirent/direct, or whatever the directory structure > may be called. POSIX requires open() to work on directories, and GNU find has been using open() and not opendir() for some time now (although with the recent switch in find to use gnulib's fts module, that will change in find 4.3.x.) The only bug that I am aware of that was reported to find where open(dir) failed was due to a cygwin bug which has since been fixed in cygwin. If, in fact, we do find a non-compliant system where open() fails on dirs, it might be better if that system were given a gnulib module that implemented a wrapper around open which calls stat then open/opendir as needed, rather than penalizing the majority of compliant systems. > Sure. > Is it sufficient to abondon copyright, Nope - FSF requires assignment of copyright, not abandonment. - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDMVFO84KuGfSFAYARArbWAJ4u5vf2mb2m41Xf4PXKUmrcl4vpkgCgiHLy XtODojf1rUFqFXGe6gw8bUA= =69ER -----END PGP SIGNATURE----- From MAILER-DAEMON Wed Sep 21 09:48:17 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EI4xM-00014u-8r for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 09:48:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EI4xH-000129-6g for bug-coreutils@gnu.org; Wed, 21 Sep 2005 09:48:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EI4x7-0000wR-9g for bug-coreutils@gnu.org; Wed, 21 Sep 2005 09:48:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EI4x7-00084Z-2H for bug-coreutils@gnu.org; Wed, 21 Sep 2005 09:48:01 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EI4bu-0000mU-EX for bug-coreutils@gnu.org; Wed, 21 Sep 2005 09:26:08 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id A18BE346; Wed, 21 Sep 2005 15:26:02 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14344; Wed, 21 Sep 05 15:25:02 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id 7457714F; Wed, 21 Sep 2005 15:24:56 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 1B1A044004; Wed, 21 Sep 2005 15:24:56 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11523-01-10; Wed, 21 Sep 2005 15:24:55 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id EAE0244002; Wed, 21 Sep 2005 15:24:54 +0200 (CEST) Received: (nullmailer pid 5940 invoked by uid 30270); Wed, 21 Sep 2005 13:24:54 -0000 From: "Alfred M\. Szmidt" To: Eric Blake In-reply-to: <4331514E.6080703@byu.net> (message from Eric Blake on Wed, 21 Sep 2005 06:25:50 -0600) References: <20050919172630.GV2965@suse.de> <87hdcfzef5.fsf@penguin.cs.ucla.edu> <20050920205438.GD2965@suse.de> <4331514E.6080703@byu.net> Date: Wed, 21 Sep 2005 15:24:54 +0200 Message-Id: <1127309094.826562.5939.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org, eggert@CS.UCLA.EDU, jw@suse.de Subject: Re: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 13:48:14 -0000 > Sure. > Is it sufficient to abondon copyright, Nope - FSF requires assignment of copyright, not abandonment. This is not true. But one must do so in writting (i.e. signing a copyright disclaimer, which more or less puts the changes/program into the Public Domain). From MAILER-DAEMON Wed Sep 21 17:02:56 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIBk0-0005aw-58 for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:02:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIBjx-0005a3-6q for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:02:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIBju-0005Yi-7N for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:02:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIBca-00033i-VL for bug-coreutils@gnu.org; Wed, 21 Sep 2005 16:55:17 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIBRD-0004wW-Fa for bug-coreutils@gnu.org; Wed, 21 Sep 2005 16:43:31 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8LKhO402642; Wed, 21 Sep 2005 13:43:24 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIBR6-0004HJ-Fa; Wed, 21 Sep 2005 13:43:24 -0700 To: Juergen Weigert References: <20050919172630.GV2965@suse.de> <87hdcfzef5.fsf@penguin.cs.ucla.edu> <20050920205438.GD2965@suse.de> From: Paul Eggert Date: Wed, 21 Sep 2005 13:43:24 -0700 In-Reply-To: <20050920205438.GD2965@suse.de> (Juergen Weigert's message of "Tue, 20 Sep 2005 22:54:38 +0200") Message-ID: <874q8e9moj.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: df enhancment for removable media X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 21:02:54 -0000 Juergen Weigert writes: >> Unless I'm missing something I'd rather not change the default behavor >> of df, as that would be a compatibility hassle. That is, df shouldn't >> attempt to mount file systems by default; it should do so only if the >> user asks, with a new option. > > These hald mounts are different. For almost every aspect such a device > appears to be mounted. So I figured, df should also pretend the > device is mounted. But lots of programs other than df invoke statfs. We shouldn't have to change them all. Instead, it would be much better to fix statfs to do the right thing with hald mounts. statfs should return values that are consistent with every other system call: it should not return incorrect values simply for the convenience of some low-level hardware abstraction layer. Please also see the message from Ivan Guyrdiev of Cornell archived at dated 2005-07-20 in which he says something similar: the statfs implementation needs to get fixed. > Looks ugly in df.c, right. But in fsusage.c we'd have to place the > new code in multiple implementations. Ugly too. It would only need to be placed in sections corresponding to implementations that have the bug. Currently, that's just one implementation: GNU/Linux, and only a small subset of these hosts as well. Since the workaround issues more system calls, it would be nice to detect the broken implementations at compile-time somehow, or at least filter out the obviously non-broken implementations. From MAILER-DAEMON Wed Sep 21 22:35:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIGwH-0006Ak-4C for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 22:35:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EI9wY-0006b3-Cw for bug-coreutils@gnu.org; Wed, 21 Sep 2005 15:07:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EI9u7-0005p3-7e for bug-coreutils@gnu.org; Wed, 21 Sep 2005 15:05:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EI9u4-0005RO-Rc for bug-coreutils@gnu.org; Wed, 21 Sep 2005 15:05:12 -0400 Received: from [216.16.235.2] (helo=nic.netdirect.ca) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EI9bV-0004Hz-Vm for bug-coreutils@gnu.org; Wed, 21 Sep 2005 14:46:03 -0400 X-Envelope-To: Received: from localhost (rubicon.netdirect.ca [216.16.235.2]) by nic.netdirect.ca (8.13.1/8.13.1) with ESMTP id j8LIjnrx026072 for ; Wed, 21 Sep 2005 14:45:49 -0400 Date: Wed, 21 Sep 2005 14:45:49 -0400 From: Chris Frey To: bug-coreutils@gnu.org Message-ID: <20050921184549.GA25767@netdirect.ca> References: <20050914121407.GA9040@netdirect.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050914121407.GA9040@netdirect.ca> User-Agent: Mutt/1.4.1i X-Net-Direct-Inc-MailScanner-Information: Please contact the ISP for more information X-Net-Direct-Inc-MailScanner: Found to be clean X-MailScanner-From: X-Mailman-Approved-At: Wed, 21 Sep 2005 22:35:55 -0400 Subject: Re: [PATCH] split: adding --exec, --exec-wait, and --pause X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 19:07:46 -0000 Hi folks, I haven't seen any comments on this patch yet. What can I do to help get this patch included in coreutils? Thanks, - Chris On Wed, Sep 14, 2005 at 08:14:07AM -0400, Chris Frey wrote: > Hi, > > This is an initial rough draft of a patch to add exec and pause support to > the split command. > > The basic idea is to let the user have some control of what happens to > each output file as it is created. A command may be run (say burning > file chunks to CD), or split can pause for the user to press ENTER > after each output file is closed. > > The new help options look like this: > > -e, --exec=CMD run CMD after each output file is closed > -w, --exec-wait=CMD run CMD after each output file is closed > and wait for the child to exit > -p, --pause pause for keypress after each output file is closed > > I'm not happy with the futzing around with the STDIN_FILENO, as both exec > and pause need to read from the user's terminal, not the data stream. > What I've done is check if STDOUT_FILENO is a tty, and if so, open() it. > This causes problems if you su to another user and your tty is owned > by the first user, but I'm not sure how to get around that. > > This patch is in the public domain. > > Let me know what you think, > - Chris > > > --- split.c 2005-09-14 08:00:12.000000000 -0400 > +++ split-cdf01.c 2005-09-14 07:59:48.000000000 -0400 > @@ -76,6 +76,17 @@ > output file is opened. */ > static bool verbose; > > +/* If true, pause after each output file is closed, to let the user press > + ENTER. Use tty_pause_fd for the I/O. */ > +static bool pause_mode; > +static int tty_pause_fd; > + > +/* The user-specified command to run after each output file is closed. > + Run it through sprintf first in order to place the latest output > + filename in the command */ > +static char *exec_command; > +static bool exec_wait; > + > /* For long options that have no equivalent short option, use a > non-character as a pseudo short option, starting with CHAR_MAX + 1. */ > enum > @@ -91,6 +102,9 @@ > {"suffix-length", required_argument, NULL, 'a'}, > {"numeric-suffixes", no_argument, NULL, 'd'}, > {"verbose", no_argument, NULL, VERBOSE_OPTION}, > + {"pause", no_argument, NULL, 'p'}, > + {"exec", required_argument, NULL, 'e'}, > + {"exec-wait", required_argument, NULL, 'w'}, > {GETOPT_HELP_OPTION_DECL}, > {GETOPT_VERSION_OPTION_DECL}, > {NULL, 0, NULL, 0} > @@ -122,7 +136,11 @@ > -b, --bytes=SIZE put SIZE bytes per output file\n\ > -C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\ > -d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\ > + -e, --exec=CMD run CMD after each output file is closed\n\ > + -w, --exec-wait=CMD run CMD after each output file is closed\n\ > + and wait for the child to exit\n\ > -l, --lines=NUMBER put NUMBER lines per output file\n\ > + -p, --pause pause for keypress after each output file is closed\n\ > "), DEFAULT_SUFFIX_LENGTH); > fputs (_("\ > --verbose print a diagnostic to standard error just\n\ > @@ -195,6 +213,81 @@ > } > } > > + > +static void > +run_exec_command (void) > +{ > + int child_pid = fork(); > + > + if (child_pid == 0) > + { > + /* child process */ > + char *cmd_line; > + char tty_name[100]; > + int stdin_fd; > + > + /* close all data files */ > + close (STDIN_FILENO); > + if (output_desc >= 0) > + close (output_desc); > + if (pause_mode) > + close (tty_pause_fd); > + > + /* recreate a stdin for the child */ > + if (ttyname_r(STDOUT_FILENO, tty_name, sizeof(tty_name)) != 0) > + error (EXIT_FAILURE, errno, "can't discover tty name"); > + stdin_fd = open (tty_name, O_RDWR); > + if (stdin_fd == -1) > + error (EXIT_FAILURE, errno, "can't open tty for " > + "pause prompting"); > + if (stdin_fd != STDIN_FILENO) > + { > + dup2 (stdin_fd, STDIN_FILENO); > + close (stdin_fd); > + } > + > + /* build the command line, passing a few filenames so the user > + * can use multiple %s if he needs to... the cheap way */ > + asprintf (&cmd_line, exec_command, outfile, outfile, outfile, outfile, > + outfile, outfile, outfile); > + > + /* exec it */ > + execl ("/bin/sh", "/bin/sh", "-c", cmd_line, NULL); > + > + /* exit with failure if we get here */ > + exit (1); > + } > + else if (child_pid == -1) > + { > + /* parent process, child had problems */ > + error (EXIT_FAILURE, errno, "can't fork to exec command"); > + } > + else > + { > + /* parent process, success */ > + if (exec_wait) > + waitpid (child_pid, NULL, 0); > + } > +} > + > + > +static void > +split_point (void) > +{ > + if (exec_command) > + run_exec_command (); > + > + if (pause_mode) > + { > + char nothing; > + write(tty_pause_fd, "Press ENTER to continue with next split file\n" > + "Just finished: ", 60); > + write(tty_pause_fd, outfile, strlen(outfile)); > + read(tty_pause_fd, ¬hing, 1); > + } > +} > + > + > /* Write BYTES bytes at BP to an output file. > If NEW_FILE_FLAG is true, open the next output file. > Otherwise add to the same output file already in use. */ > @@ -206,6 +299,8 @@ > { > if (output_desc >= 0 && close (output_desc) < 0) > error (EXIT_FAILURE, errno, "%s", outfile); > + else if (output_desc >= 0) > + split_point (); > > next_file_name (); > if (verbose) > @@ -406,7 +501,7 @@ > /* This is the argv-index of the option we will read next. */ > int this_optind = optind ? optind : 1; > > - c = getopt_long (argc, argv, "0123456789C:a:b:dl:", longopts, NULL); > + c = getopt_long (argc, argv, "0123456789C:a:b:dl:pe:w:", longopts, NULL); > if (c == -1) > break; > > @@ -494,6 +589,43 @@ > suffix_alphabet = "0123456789"; > break; > > + case 'p': > + pause_mode = true; > + if (isatty(STDOUT_FILENO)) > + { > + /* we have a valid tty on stdout, let's try to open it for > + * reading and writing (for the prompt), since stdin is > + * being used for data */ > + char tty_name[100]; > + if (ttyname_r(STDOUT_FILENO, tty_name, sizeof(tty_name)) != 0) > + error (EXIT_FAILURE, errno, "can't discover tty name"); > + tty_pause_fd = open (tty_name, O_RDWR); > + if (tty_pause_fd == -1) > + error (EXIT_FAILURE, errno, "can't open tty for " > + "pause prompting"); > + } > + else > + { > + error (EXIT_FAILURE, 0, "stdout is not a tty, can't prompt" > + " on pause points"); > + } > + break; > + > + case 'e': > + case 'w': > + if (! exec_command) > + { > + size_t cmd_length = strlen(optarg); > + exec_command = xmalloc (cmd_length + 1); > + strcpy (exec_command, optarg); > + > + if (c == 'w') > + exec_wait = true; > + } > + else > + error (EXIT_FAILURE, 0, "exec already specified!"); > + break; > + > case VERBOSE_OPTION: > verbose = true; > break; > @@ -578,6 +710,8 @@ > error (EXIT_FAILURE, errno, "%s", infile); > if (output_desc >= 0 && close (output_desc) < 0) > error (EXIT_FAILURE, errno, "%s", outfile); > + else if (output_desc >= 0) > + split_point (); > > exit (EXIT_SUCCESS); > } > From MAILER-DAEMON Wed Sep 21 22:35:57 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIGwH-0006Aq-Ao for mharc-bug-coreutils@gnu.org; Wed, 21 Sep 2005 22:35:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EICYY-0004Gx-T8 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:55:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EICY2-0003yQ-Fm for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:54:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EICY0-0003Ei-5j for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:54:36 -0400 Received: from [82.232.2.251] (helo=farad.aurel32.net) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EICM9-0001NY-1n for bug-coreutils@gnu.org; Wed, 21 Sep 2005 17:42:21 -0400 Received: from hertz.aurel32.net ([2001:618:400:fc13:2e0:18ff:fea3:b80f]) by farad.aurel32.net with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1EICLr-0005V2-2h for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:42:04 +0200 Received: from aurel32 by hertz.aurel32.net with local (Exim 4.52) id 1EICLo-0006qu-HL for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:42:00 +0200 Date: Wed, 21 Sep 2005 23:42:00 +0200 From: Aurelien Jarno To: bug-coreutils@gnu.org Message-ID: <20050921214155.GA24657@hertz.aurel32.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Mailer: Mutt 1.5.10i (2005-08-11) User-Agent: Mutt/1.5.10i X-Mailman-Approved-At: Wed, 21 Sep 2005 22:35:55 -0400 Subject: [PATCH] cp --no-derefence --link assumes a Linux kernel X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 21:55:12 -0000 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, POSIX.1-2001 says that link() should dereference symlinks. The Linux kernel does not follow POSIX, so that calling cp with --no-dereference and --link works as expected. However on non-Linux kernel, this does not work as expected, the symlinks being dereferenced. This is even worse with symlinks pointing to non-existing paths, where contrary to Linux, cp fails in such cases. I suggest to make regular copy of the symlink in such cases, to increase portability of shell scripts. This is the purpose of the attached patch. Regards, Aurelien --=20 .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: attachment; filename="coreutils_cp_link_posix.patch" Content-Transfer-Encoding: quoted-printable --- coreutils-5.2.1.orig/src/copy.c 2005-09-19 00:35:32.000000000 +0200 +++ coreutils-5.2.1/src/copy.c 2005-09-19 00:34:53.000000000 +0200 @@ -1411,7 +1411,15 @@ } } #endif +/* According to POSIX.1-2001, a call to link() should dereference symlinks= =2E cp=20 + called with the --no-dereference argument should not. */ +#ifdef LINK_FOLLOWS_SYMLINKS + /* For kernels that do not follow POSIX, don't call link() and make a co= py. */ + else if (x->hard_link && !(S_ISLNK (src_mode) && x->dereference =3D=3D D= EREF_NEVER)) +#else + /* For kernels that follow POSIX, use link() in all cases. */ else if (x->hard_link) +#endif { preserve_metadata =3D 0; if (link (src_path, dst_path)) --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/kFreeBSD) iD8DBQFDMdOjw3ao2vG823MRAibQAKCBZhWwqsrPsNcrT0OTJVlwMVKmmACcDTky yMw36FiZoPbGjfivH29b6DQ= =MEqb -----END PGP SIGNATURE----- --gatW/ieO32f1wygP-- From MAILER-DAEMON Thu Sep 22 00:30:19 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIIix-0000uL-He for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:30:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIIcU-0007yj-Pb for bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:23:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIIcH-0007sl-Q3 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:23:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIIcG-0007jC-DG for bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:23:24 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIIX3-0008Fg-V7 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:18:02 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M4Gv400313; Wed, 21 Sep 2005 21:16:57 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIIW1-0001Z5-9P; Wed, 21 Sep 2005 21:16:57 -0700 To: Aurelien Jarno References: <20050921214155.GA24657@hertz.aurel32.net> From: Paul Eggert Date: Wed, 21 Sep 2005 21:16:57 -0700 In-Reply-To: <20050921214155.GA24657@hertz.aurel32.net> (Aurelien Jarno's message of "Wed, 21 Sep 2005 23:42:00 +0200") Message-ID: <87k6h9n3d2.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: [PATCH] cp --no-derefence --link assumes a Linux kernel X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 04:30:17 -0000 Aurelien Jarno writes: > POSIX.1-2001 says that link() should dereference symlinks. The Linux > kernel does not follow POSIX, so that calling cp with --no-dereference > and --link works as expected. However on non-Linux kernel, this does not > work as expected, the symlinks being dereferenced. This is even worse > with symlinks pointing to non-existing paths, where contrary to Linux, > cp fails in such cases. Sorry, I can't quite understand your explanation. Can you please give a series of shell commands that illustrates the problems? Also, what does "cp --version" and "uname -a" say for you? Thanks. From MAILER-DAEMON Thu Sep 22 01:59:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIK7Y-0007Ai-U9 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 01:59:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIK7K-00079F-9O for bug-coreutils@gnu.org; Thu, 22 Sep 2005 01:59:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIK7D-000778-Uc for bug-coreutils@gnu.org; Thu, 22 Sep 2005 01:59:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIK7D-0006uK-CY for bug-coreutils@gnu.org; Thu, 22 Sep 2005 01:59:27 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIJta-0004lv-1G for bug-coreutils@gnu.org; Thu, 22 Sep 2005 01:45:22 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M5jK404082 for ; Wed, 21 Sep 2005 22:45:20 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIJtY-0005Ee-Iu for bug-coreutils@gnu.org; Wed, 21 Sep 2005 22:45:20 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 22:45:20 -0700 Message-ID: <87fyrxmz9r.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: mkdir-p.c port to Solaris 8 NFS client X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 05:59:36 -0000 I installed the following to handle a porting problem on Solaris 8. 2005-09-21 Paul Eggert * mkdir-p.c: Change "#if HAVECONFIG_H" to "#ifdef", for compatibility with latest gnulib. (ENOSYS): Define to EEXIST if not defined. (make_dir_parents): Treat ENOSYS like EEXIST. Index: mkdir-p.c =================================================================== RCS file: /fetish/cu/lib/mkdir-p.c,v retrieving revision 1.10 retrieving revision 1.11 diff -p -u -r1.10 -r1.11 --- mkdir-p.c 2 Jul 2005 08:41:46 -0000 1.10 +++ mkdir-p.c 22 Sep 2005 05:42:26 -0000 1.11 @@ -19,7 +19,7 @@ /* Written by David MacKenzie and Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -45,6 +45,10 @@ #include "quote.h" #include "stat-macros.h" +#ifndef ENOSYS +# define ENOSYS EEXIST +#endif + #define WX_USR (S_IWUSR | S_IXUSR) /* Ensure that the directory ARG exists. @@ -211,10 +215,14 @@ make_dir_parents (char const *arg, leading_dirs = new; } } - else if (errno == EEXIST) + else if (errno == EEXIST || errno == ENOSYS) { /* A file is already there. Perhaps it is a directory. - If not, it will be diagnosed later. */ + If not, it will be diagnosed later. + + The ENOSYS is for Solaris 8 NFS clients, which can + fail with errno == ENOSYS if mkdir is invoked on an + NFS mount point. */ } else { From MAILER-DAEMON Thu Sep 22 02:25:18 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIKWE-0006Wt-0f for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:25:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIKWA-0006Vb-Et for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:25:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIKW8-0006Ub-H2 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:25:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIKW6-0006TA-VV for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:25:11 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKV6-00075u-Vy for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:24:09 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6O8405962 for ; Wed, 21 Sep 2005 23:24:08 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKV5-0005J3-S3 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:24:07 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:24:07 -0700 Message-ID: <877jd9mxh4.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: new files imported from gnulib into coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 06:25:16 -0000 I imported the following new files from gnulib into coreutils; they're apparently needed due to recent changes in modules that coreutils is using from gnulib. lib/canon-host.h lib/gai_strerror.c lib/getaddrinfo.c lib/getaddrinfo.h lib/getdelim.c lib/getdelim.h lib/mbchar.c lib/mbchar.h lib/mbuiter.h lib/strcase.h lib/strnlen.h lib/strnlen1.c lib/strnlen1.h lib/strstr.h m4/getaddrinfo.m4 m4/getdelim.m4 m4/mbchar.m4 m4/mbiter.m4 m4/sockpfaf.m4 From MAILER-DAEMON Thu Sep 22 03:00:23 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIL48-0006iW-O2 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:00:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIL3n-0006ew-54 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:59:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIL3i-0006dQ-Td for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:59:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIL3h-0006bE-5v for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:59:53 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIL1Y-0000kk-Ak for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:57:40 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6vc407471 for ; Wed, 21 Sep 2005 23:57:39 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIL1W-0000z3-KL for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:57:38 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:57:38 -0700 Message-ID: <87k6h9lhct.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: rmdir.c unused macros X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:00:00 -0000 This is independent of the merge with gnulib, but I installed this: 2005-09-21 Paul Eggert * src/rmdir.c (EEXIST, ENOTEMPTY): Remove unused macros. Index: src/rmdir.c =================================================================== RCS file: /fetish/cu/src/rmdir.c,v retrieving revision 1.82 diff -p -u -r1.82 rmdir.c --- src/rmdir.c 22 Jun 2005 15:25:23 -0000 1.82 +++ src/rmdir.c 22 Sep 2005 06:49:32 -0000 @@ -37,14 +37,6 @@ #define AUTHORS "David MacKenzie" -#ifndef EEXIST -# define EEXIST 0 -#endif - -#ifndef ENOTEMPTY -# define ENOTEMPTY 0 -#endif - /* The name this program was run with. */ char *program_name; From MAILER-DAEMON Thu Sep 22 03:02:58 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIL6f-00072L-Bi for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:02:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIL6b-00071R-WC for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:02:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIL6X-00070P-W0 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:02:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIL69-0006bE-8u for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:02:25 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKYn-0007bQ-Uw for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:27:58 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6Ru406149 for ; Wed, 21 Sep 2005 23:27:57 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKYm-0005JN-U0 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:27:56 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:27:56 -0700 Message-ID: <873bnxmxar.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: removed xanstrftime from coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:02:55 -0000 I removed xanstrftime.h, xanstrftime.c, xanstrftime.m4 from coreutils as they're no longer used. From MAILER-DAEMON Thu Sep 22 03:03:11 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIL6s-00077B-P0 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIL6p-000761-LR for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIL6n-00075Z-U9 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIL5d-0006bE-8b for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:01:53 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKhG-00086N-D1 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:36:42 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6af406627 for ; Wed, 21 Sep 2005 23:36:41 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKhF-0005Jk-AH for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:36:41 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:36:41 -0700 Message-ID: <87y85plibq.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: xalloc.h, system.h changes for X2REALLOC etc. X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:03:08 -0000 When merging from gnulib I discovered I'm still a bit at sea about what to do about the X2REALLOC and X2NREALLOC macros; instead of thinking it through I thought it best for now to revert xalloc.h to gnulib and move the new stuff to src/system.h. I installed this: 2005-09-21 Paul Eggert * lib/xalloc.h (VERIFY_EXPR, X2NREALLOC, X2REALLOC): Remove. The latter two macros are moving to ../src/system.h for now. This reverts this file to the gnulib version. * src/system.h (X2NREALLOC, X2REALLOC): Moved here from ../lib/xalloc.h, with args properly parenthesized, and using verify_expr rather than the old VERIFY_EXPR. Index: lib/xalloc.h =================================================================== RCS file: /fetish/cu/lib/xalloc.h,v retrieving revision 1.32 diff -p -u -r1.32 xalloc.h --- lib/xalloc.h 13 Sep 2005 21:11:25 -0000 1.32 +++ lib/xalloc.h 22 Sep 2005 06:24:28 -0000 @@ -1,7 +1,7 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,24 +56,6 @@ void *x2nrealloc (void *p, size_t *pn, s void *xmemdup (void const *p, size_t s); char *xstrdup (char const *str); -/* Verify a requirement at compile-time (unlike assert, which is runtime). */ -# undef VERIFY_EXPR -# define VERIFY_EXPR(assertion) \ - (void)((struct {char a[(assertion) ? 1 : -1]; } *) 0) - -/* This is simply a shorthand for the common case in which - the third argument to x2nrealloc would be `sizeof (*P)'. - Ensure that sizeof (*P) is *not* 1. In that case, it'd be - better to use X2REALLOC, although not strictly necessary. */ -# define X2NREALLOC(P, PN) (VERIFY_EXPR (sizeof(*P) != 1), \ - x2nrealloc (P, PN, sizeof (*P))) - -/* Using x2realloc (when appropriate) usually makes your code more - readable than using x2nrealloc, but it also makes it so your - code will malfunction if sizeof (*P) ever becomes 2 or greater. - So use this macro instead of using x2realloc directly. */ -# define X2REALLOC(P, PN) (VERIFY_EXPR (sizeof(*P) == 1), x2realloc (P, PN)) - /* Return 1 if an array of N objects, each of size S, cannot exist due to size arithmetic overflow. S must be positive and N must be nonnegative. This is a macro, not an inline function, so that it Index: src/system.h =================================================================== RCS file: /fetish/cu/src/system.h,v retrieving revision 1.134 diff -p -u -r1.134 system.h --- src/system.h 23 Aug 2005 15:05:54 -0000 1.134 +++ src/system.h 22 Sep 2005 06:25:10 -0000 @@ -513,6 +513,20 @@ uid_t getuid (); #endif #include "xalloc.h" +#include "verify.h" + +/* This is simply a shorthand for the common case in which + the third argument to x2nrealloc would be `sizeof *(P)'. + Ensure that sizeof *(P) is *not* 1. In that case, it'd be + better to use X2REALLOC, although not strictly necessary. */ +#define X2NREALLOC(P, PN) (verify_expr (sizeof *(P) != 1), \ + x2nrealloc (P, PN, sizeof *(P))) + +/* Using x2realloc (when appropriate) usually makes your code more + readable than using x2nrealloc, but it also makes it so your + code will malfunction if sizeof *(P) ever becomes 2 or greater. + So use this macro instead of using x2realloc directly. */ +#define X2REALLOC(P, PN) (verify_expr (sizeof *(P) == 1), x2realloc (P, PN)) #if ! defined HAVE_MEMPCPY && ! defined mempcpy /* Be CAREFUL that there are no side effects in N. */ @@ -585,7 +599,6 @@ enum _(" --version output version information and exit\n") #include "closeout.h" -#include "verify.h" #include "version-etc.h" #define case_GETOPT_VERSION_CHAR(Program_name, Authors) \ From MAILER-DAEMON Thu Sep 22 03:03:50 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIL7V-0007Jq-MS for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIL7T-0007Id-QK for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIL7S-0007Hq-6J for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:47 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIL5S-0006bE-CN for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:01:42 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKlD-0008KF-Au for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:40:47 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6ej406853 for ; Wed, 21 Sep 2005 23:40:45 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKlB-0005MR-Qx for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:40:45 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:40:45 -0700 Message-ID: <87u0gdli4y.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: argmatch.h simplification using verify.h X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:03:48 -0000 I installed this to simplify argmatch.h using verify.h, since I'm going to put verify.h into gnulib: 2005-09-21 Paul Eggert * lib/argmatch.h (GL_CONCAT): Remove. Include "verify.h" instead. (ARGMATCH_CONSTRAINT, ARGMATCH_ASSERT): Remove. (ARGMATCH_VERIFY): Rewrite in terms of new verify macros. Index: lib/argmatch.h =================================================================== RCS file: /fetish/cu/lib/argmatch.h,v retrieving revision 1.26 diff -p -u -r1.26 argmatch.h --- lib/argmatch.h 4 Jul 2005 14:47:42 -0000 1.26 +++ lib/argmatch.h 22 Sep 2005 06:24:28 -0000 @@ -25,34 +25,15 @@ # include -# ifndef verify_dcl -# define GL_CONCAT0(x, y) x##y -# define GL_CONCAT(x, y) GL_CONCAT0 (x, y) - -/* Verify requirement, R, at compile-time, as a declaration. - The implementation uses a struct declaration whose name includes the - expansion of __LINE__, so there is a small chance that two uses of - verify_dcl from different files will end up colliding (for example, - f.c includes f.h and verify_dcl is used on the same line in each). */ -# define verify_dcl(R) \ - struct GL_CONCAT (ct_assert_, __LINE__) { char a[(R) ? 1 : -1]; } -# endif +# include "verify.h" # define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) -# define ARGMATCH_CONSTRAINT(Arglist, Vallist) \ - (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1) - /* Assert there are as many real arguments as there are values - (argument list ends with a NULL guard). ARGMATCH_VERIFY is - preferred, since it is guaranteed to be checked at compile-time. - ARGMATCH_ASSERT is for backward compatibility only. */ + (argument list ends with a NULL guard). */ # define ARGMATCH_VERIFY(Arglist, Vallist) \ - verify_dcl (ARGMATCH_CONSTRAINT (Arglist, Vallist)) - -# define ARGMATCH_ASSERT(Arglist, Vallist) \ - assert (ARGMATCH_CONSTRAINT (Arglist, Vallist)) + verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1) /* Return the index of the element of ARGLIST (NULL terminated) that matches with ARG. If VALLIST is not NULL, then use it to resolve From MAILER-DAEMON Thu Sep 22 03:03:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIL7f-0007O0-33 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIL7b-0007MV-D3 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIL56-0006rn-8Z for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:01:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIL55-0006bE-Hg for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:01:19 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKqy-0000AS-D1 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:46:45 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M6kh407032 for ; Wed, 21 Sep 2005 23:46:43 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKqw-0005Og-Qx for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:46:42 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:46:42 -0700 Message-ID: <87psr1lhv1.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: nontrivial sync from gnulib for canon-host, mbchar, getline X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:03:56 -0000 Here are some modules that contain nontrivial changes, synced from gnulib. Most of these have to do with the new changes for getline and case-insensitive string comparison and getting canonical host names. 2005-09-21 Paul Eggert * canon-host.c, getline.c, getline.h, getpass.c, strcasecmp.c: * strncasecmp.c, strstr.c: Nontrivial sync from gnulib. * canon-host.m4, getline.m4, mbrtowc.m4, strcase.m4, strstr.m4: Nontrivial sync from gnulib. Index: lib/canon-host.c =================================================================== RCS file: /fetish/cu/lib/canon-host.c,v retrieving revision 1.21 diff -p -u -r1.21 canon-host.c --- lib/canon-host.c 2 Jul 2005 08:41:46 -0000 1.21 +++ lib/canon-host.c 22 Sep 2005 06:44:10 -0000 @@ -1,9 +1,8 @@ /* Host name canonicalization - Copyright (C) 1995, 1999, 2000, 2002, 2003, 2004, 2005 Free Software - Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. - Written by Miles Bader + Written by Derek Price . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,103 +22,69 @@ # include #endif -#include -#include -#include -#include -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif +#include "canon-host.h" +#include "getaddrinfo.h" #include "strdup.h" -/* Returns the canonical hostname associated with HOST (allocated in a static - buffer), or NULL if it can't be determined. */ +/* Store the last error for the single-threaded version of this function. */ +static int last_cherror; + +/* Single-threaded of wrapper for canon_host_r. After a NULL return, error + messages may be retrieved via ch_strerror(). */ char * -canon_host (char const *host) +canon_host (const char *host) { - char *h_addr_copy = NULL; - -#if HAVE_GETADDRINFO - { - struct addrinfo hint = { 0, }; - struct addrinfo *res = NULL; - hint.ai_flags = AI_CANONNAME; - if (getaddrinfo (host, NULL, &hint, &res) == 0) - { - h_addr_copy = strdup (res->ai_canonname); - freeaddrinfo (res); - } - } -#elif HAVE_GETHOSTBYNAME - { - struct hostent *he = gethostbyname (host); - - if (he) - { -# ifdef HAVE_GETHOSTBYADDR - char *addr = NULL; - - /* Try and get an ascii version of the numeric host address. */ - switch (he->h_addrtype) - { -# ifdef HAVE_INET_NTOA - case AF_INET: - addr = inet_ntoa (*(struct in_addr *) he->h_addr); - break; -# endif /* HAVE_INET_NTOA */ - } - - if (addr && strcmp (he->h_name, addr) == 0) - { - /* gethostbyname has returned a string representation of the IP - address, for example, "127.0.0.1". So now, look up the host - name via the address. Although it may seem reasonable to look - up the host name via the address, we must not pass `he->h_addr' - directly to gethostbyaddr because on some systems he->h_addr - is located in a static library buffer that is reused in the - gethostbyaddr call. Make a copy and use that instead. */ - h_addr_copy = (char *) malloc (he->h_length); - if (h_addr_copy == NULL) - he = NULL; - else - { - memcpy (h_addr_copy, he->h_addr, he->h_length); - he = gethostbyaddr (h_addr_copy, he->h_length, he->h_addrtype); - free (h_addr_copy); - } - } -# endif /* HAVE_GETHOSTBYADDR */ - - if (he) - h_addr_copy = strdup (he->h_name); - } - } -#endif /* HAVE_GETHOSTBYNAME */ - - return h_addr_copy; + return canon_host_r (host, &last_cherror); } -#ifdef TEST_CANON_HOST -int -main (int argc, char **argv) +/* Return a malloc'd string containing the canonical hostname associated with + HOST, or NULL if a canonical name cannot be determined. On NULL return, + if CHERROR is not NULL, set *CHERROR to an error code as returned by + getaddrinfo(). Use ch_strerror_r() or gai_strerror() to convert a *CHERROR + value to a string suitable for error messages. + + WARNINGS + HOST must be a string representation of a resolvable name for this host. + Strings containing an IP address in dotted decimal notation will be + returned as-is, without further resolution. + + The use of the word "canonical" in this context is unfortunate but + entrenched. The value returned by this function will be the end result + of the resolution of any CNAME chains in the DNS. There may only be one + such value for any given hostname, though the actual IP address + referenced by this value and the device using that IP address may each + actually have any number of such "canonical" hostnames. See the POSIX + getaddrinfo spec , + RFC 1034 , & RFC 2181 + for more on what this confusing + term really refers to. */ +char * +canon_host_r (char const *host, int *cherror) { - int i; - for (i = 1; i < argc; i++) + char *retval = NULL; + static struct addrinfo hints; + struct addrinfo *res = NULL; + int status; + + hints.ai_flags = AI_CANONNAME; + status = getaddrinfo (host, NULL, &hints, &res); + if (!status) { - char *s = canon_host (argv[i]); - printf ("%s: %s\n", argv[i], (s ? s : "")); + retval = strdup (res->ai_canonname); + if (!retval && cherror) + *cherror = EAI_MEMORY; + freeaddrinfo (res); } - exit (0); + else if (cherror) + *cherror = status; + + return retval; +} + +/* Return a string describing the last error encountered by canon_host. */ +const char * +ch_strerror (void) +{ + return gai_strerror (last_cherror); } -#endif /* TEST_CANON_HOST */ Index: lib/getline.c =================================================================== RCS file: /fetish/cu/lib/getline.c,v retrieving revision 1.15 diff -p -u -r1.15 getline.c --- lib/getline.c 14 May 2005 07:58:06 -0000 1.15 +++ lib/getline.c 22 Sep 2005 06:44:10 -0000 @@ -1,44 +1,32 @@ -/* getline.c -- Replacement for GNU C library function getline +/* getline.c --- Implementation of replacement getline function. + Copyright (C) 2005 Free Software Foundation, Inc. - Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003, 2004 Free - Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ +/* Written by Simon Josefsson. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif +#include "getdelim.h" #include "getline.h" -#if ! (defined __GNU_LIBRARY__ && HAVE_GETDELIM) - -# include "getndelim2.h" - -ssize_t -getdelim (char **lineptr, size_t *linesize, int delimiter, FILE *stream) -{ - return getndelim2 (lineptr, linesize, 0, GETNLINE_NO_LIMIT, delimiter, EOF, - stream); -} -#endif - ssize_t -getline (char **lineptr, size_t *linesize, FILE *stream) +getline (char **lineptr, size_t *n, FILE *stream) { - return getdelim (lineptr, linesize, '\n', stream); + return getdelim (lineptr, n, '\n', stream); } Index: lib/getline.h =================================================================== RCS file: /fetish/cu/lib/getline.h,v retrieving revision 1.14 diff -p -u -r1.14 getline.h --- lib/getline.h 14 May 2005 07:58:06 -0000 1.14 +++ lib/getline.h 22 Sep 2005 06:44:10 -0000 @@ -1,39 +1,28 @@ -/* Replacement for GNU C library function getline +/* getline.h --- Prototype for replacement getline function. + Copyright (C) 2005 Free Software Foundation, Inc. - Copyright (C) 1995, 1997, 1999, 2000, 2001, 2002, 2003 Free - Software Foundation, Inc. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef GETLINE_H_ -# define GETLINE_H_ 1 +/* Written by Simon Josefsson. */ +/* Get size_t, FILE, ssize_t. And getline, if available. */ # include # include - -/* Get ssize_t. */ # include -/* glibc2 has these functions declared in . Avoid redeclarations. */ -# if __GLIBC__ < 2 - -extern ssize_t getline (char **_lineptr, size_t *_linesize, FILE *_stream); - -extern ssize_t getdelim (char **_lineptr, size_t *_linesize, int _delimiter, - FILE *_stream); - -# endif - -#endif /* not GETLINE_H_ */ +#if !HAVE_DECL_GETLINE +ssize_t getline (char **lineptr, size_t *n, FILE *stream); +#endif /* !HAVE_GETLINE */ Index: lib/getpass.c =================================================================== RCS file: /fetish/cu/lib/getpass.c,v retrieving revision 1.10 diff -p -u -r1.10 getpass.c --- lib/getpass.c 14 May 2005 07:58:06 -0000 1.10 +++ lib/getpass.c 22 Sep 2005 06:44:10 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2001, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -15,47 +15,32 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif -#if !_LIBC -# include "getpass.h" -#endif +#include "getpass.h" -#if _LIBC -# define HAVE_STDIO_EXT_H 1 -#endif +#include + +#if !defined _WIN32 #include -#include #if HAVE_STDIO_EXT_H # include -#else -# define __fsetlocking(stream, type) /* empty */ #endif -#if !_LIBC -# include "getline.h" +#if !HAVE___FSETLOCKING +# define __fsetlocking(stream, type) /* empty */ #endif -#include -#include - -#if _LIBC -# include +#if HAVE_TERMIOS_H +# include #endif -#if _LIBC -# define NOTCANCEL_MODE "c" -#else -# define NOTCANCEL_MODE -#endif +#include "getline.h" -#if _LIBC -# define flockfile(s) _IO_flockfile (s) -# define funlockfile(s) _IO_funlockfile (s) -#elif USE_UNLOCKED_IO +#if USE_UNLOCKED_IO # include "unlocked-io.h" #else # if !HAVE_DECL_FFLUSH_UNLOCKED @@ -80,18 +65,6 @@ # endif #endif -#if _LIBC -# include -#else -# define __libc_cleanup_push(function, arg) /* empty */ -# define __libc_cleanup_pop(execute) /* empty */ -#endif - -#if !_LIBC -# define __getline getline -# define __tcgetattr tcgetattr -#endif - /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is done in software; there is no need to change the state of the terminal @@ -114,7 +87,7 @@ getpass (const char *prompt) FILE *tty; FILE *in, *out; struct termios s, t; - bool tty_changed; + bool tty_changed = false; static char *buf; static size_t bufsize; ssize_t nread; @@ -122,7 +95,7 @@ getpass (const char *prompt) /* Try to write to and read from the terminal if we can. If we can't open the terminal, use stderr and stdin. */ - tty = fopen ("/dev/tty", "w+" NOTCANCEL_MODE); + tty = fopen ("/dev/tty", "w+"); if (tty == NULL) { in = stdin; @@ -136,39 +109,26 @@ getpass (const char *prompt) out = in = tty; } - /* Make sure the stream we opened is closed even if the thread is - canceled. */ - __libc_cleanup_push (call_fclose, tty); - flockfile (out); /* Turn echoing off if it is on now. */ - - if (__tcgetattr (fileno (in), &t) == 0) +#if HAVE_TCGETATTR + if (tcgetattr (fileno (in), &t) == 0) { /* Save the old one. */ s = t; /* Tricky, tricky. */ - t.c_lflag &= ~(ECHO|ISIG); - tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0); + t.c_lflag &= ~(ECHO | ISIG); + tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0); } - else - tty_changed = false; +#endif /* Write the prompt. */ -#ifdef USE_IN_LIBIO - if (_IO_fwide (out, 0) > 0) - __fwprintf (out, L"%s", prompt); - else -#endif - fputs_unlocked (prompt, out); + fputs_unlocked (prompt, out); fflush_unlocked (out); /* Read the password. */ - nread = __getline (&buf, &bufsize, in); - -#if !_LIBC - /* As far as is known, glibc doesn't need this no-op fseek. */ + nread = getline (&buf, &bufsize, in); /* According to the C standard, input may not be followed by output on the same stream without an intervening call to a file @@ -180,7 +140,6 @@ getpass (const char *prompt) from POSIX version to POSIX version, so play it safe and invoke fseek even if in != out. */ fseek (out, 0, SEEK_CUR); -#endif if (buf != NULL) { @@ -193,25 +152,75 @@ getpass (const char *prompt) if (tty_changed) { /* Write the newline that was not echoed. */ -#ifdef USE_IN_LIBIO - if (_IO_fwide (out, 0) > 0) - putwc_unlocked (L'\n', out); - else -#endif - putc_unlocked ('\n', out); + putc_unlocked ('\n', out); } } } /* Restore the original setting. */ +#if HAVE_TCSETATTR if (tty_changed) - (void) tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s); + tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s); +#endif funlockfile (out); - __libc_cleanup_pop (0); - call_fclose (tty); return buf; } + +#else /* WIN32 */ + +/* Windows implementation by Martin Lambers , + improved by Simon Josefsson. */ + +/* For PASS_MAX. */ +#include + +#ifndef PASS_MAX +# define PASS_MAX 512 +#endif + +char * +getpass (const char *prompt) +{ + char getpassbuf[PASS_MAX + 1]; + size_t i = 0; + int c; + + if (prompt) + { + fputs (prompt, stderr); + fflush (stderr); + } + + for (;;) + { + c = _getch (); + if (c == '\r') + { + getpassbuf[i] = '\0'; + break; + } + else if (i < PASS_MAX) + { + getpassbuf[i++] = c; + } + + if (i >= PASS_MAX) + { + getpassbuf[i] = '\0'; + break; + } + } + + if (prompt) + { + fputs ("\r\n", stderr); + fflush (stderr); + } + + return strdup (getpassbuf); +} +#endif Index: lib/strcasecmp.c =================================================================== RCS file: /fetish/cu/lib/strcasecmp.c,v retrieving revision 1.6 diff -p -u -r1.6 strcasecmp.c --- lib/strcasecmp.c 14 May 2005 07:58:07 -0000 1.6 +++ lib/strcasecmp.c 22 Sep 2005 06:44:10 -0000 @@ -1,5 +1,7 @@ -/* strcasecmp.c -- case insensitive string comparator - Copyright (C) 1998, 1999 Free Software Foundation, Inc. +/* Case-insensitive string comparison function. + Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. + Written by Bruno Haible , 2005, + based on earlier glibc code. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,52 +17,82 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif -#ifdef LENGTH_LIMIT -# define STRXCASECMP_FUNCTION strncasecmp -# define STRXCASECMP_DECLARE_N , size_t n -# define LENGTH_LIMIT_EXPR(Expr) Expr -#else -# define STRXCASECMP_FUNCTION strcasecmp -# define STRXCASECMP_DECLARE_N /* empty */ -# define LENGTH_LIMIT_EXPR(Expr) 0 -#endif +/* Specification. */ +#include "strcase.h" -#include #include -#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) +#if HAVE_MBRTOWC +# include "mbuiter.h" +#endif -/* Compare {{no more than N characters of }}strings S1 and S2, - ignoring case, returning less than, equal to or - greater than zero if S1 is lexicographically less - than, equal to or greater than S2. */ +#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) +/* Compare strings S1 and S2, ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less than, equal to or greater + than S2. + Note: This function may, in multibyte locales, return 0 for strings of + different lengths! */ int -STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N) +strcasecmp (const char *s1, const char *s2) { - register const unsigned char *p1 = (const unsigned char *) s1; - register const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - - if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0)) + if (s1 == s2) return 0; - do + /* Be careful not to look at the entire extent of s1 or s2 until needed. + This is useful because when two strings differ, the difference is + most often already in the very few first characters. */ +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) { - c1 = TOLOWER (*p1); - c2 = TOLOWER (*p2); + mbui_iterator_t iter1; + mbui_iterator_t iter2; - if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0') - break; + mbui_init (iter1, s1); + mbui_init (iter2, s2); - ++p1; - ++p2; + while (mbui_avail (iter1) && mbui_avail (iter2)) + { + int cmp = mb_casecmp (mbui_cur (iter1), mbui_cur (iter2)); + + if (cmp != 0) + return cmp; + + mbui_advance (iter1); + mbui_advance (iter2); + } + if (mbui_avail (iter1)) + /* s2 terminated before s1. */ + return 1; + if (mbui_avail (iter2)) + /* s1 terminated before s2. */ + return -1; + return 0; } - while (c1 == c2); + else +#endif + { + const unsigned char *p1 = (const unsigned char *) s1; + const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + do + { + c1 = TOLOWER (*p1); + c2 = TOLOWER (*p2); + + if (c1 == '\0') + break; + + ++p1; + ++p2; + } + while (c1 == c2); - return c1 - c2; + return c1 - c2; + } } Index: lib/strncasecmp.c =================================================================== RCS file: /fetish/cu/lib/strncasecmp.c,v retrieving revision 1.4 diff -p -u -r1.4 strncasecmp.c --- lib/strncasecmp.c 2 Jan 1999 15:55:44 -0000 1.4 +++ lib/strncasecmp.c 22 Sep 2005 06:44:10 -0000 @@ -1,2 +1,58 @@ -#define LENGTH_LIMIT -#include "strcasecmp.c" +/* strncasecmp.c -- case insensitive string comparator + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#include "strcase.h" + +#include + +#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) + +/* Compare no more than N bytes of strings S1 and S2, + ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less + than, equal to or greater than S2. */ + +int +strncasecmp (const char *s1, const char *s2, size_t n) +{ + register const unsigned char *p1 = (const unsigned char *) s1; + register const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + if (p1 == p2 || n == 0) + return 0; + + do + { + c1 = TOLOWER (*p1); + c2 = TOLOWER (*p2); + + if (--n == 0 || c1 == '\0') + break; + + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; +} Index: lib/strstr.c =================================================================== RCS file: /fetish/cu/lib/strstr.c,v retrieving revision 1.12 diff -p -u -r1.12 strstr.c --- lib/strstr.c 14 May 2005 07:58:07 -0000 1.12 +++ lib/strstr.c 22 Sep 2005 06:44:10 -0000 @@ -1,119 +1,128 @@ -/* Copyright (C) 1994, 1999, 2002-2003 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Searching in a string. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Bruno Haible , 2005. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* - * My personal strstr() implementation that beats most other algorithms. - * Until someone tells me otherwise, I assume that this is the - * fastest implementation of strstr() in C. - * I deliberately chose not to comment it. You should have at least - * as much fun trying to understand it, as I had to write it :-). - * - * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ - -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif -#include +/* Specification. */ +#include "strstr.h" -typedef unsigned chartype; +#include /* for NULL */ -#undef strstr +#if HAVE_MBRTOWC +# include "mbuiter.h" +#endif +/* Find the first occurrence of NEEDLE in HAYSTACK. */ char * -strstr (const char *phaystack, const char *pneedle) +strstr (const char *haystack, const char *needle) { - register const unsigned char *haystack, *needle; - register chartype b, c; + /* Be careful not to look at the entire extent of haystack or needle + until needed. This is useful because of these two cases: + - haystack may be very long, and a match of needle found early, + - needle may be very long, and not even a short initial segment of + needle may be found in haystack. */ +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) + { + mbui_iterator_t iter_needle; - haystack = (const unsigned char *) phaystack; - needle = (const unsigned char *) pneedle; + mbui_init (iter_needle, needle); + if (mbui_avail (iter_needle)) + { + mbui_iterator_t iter_haystack; - b = *needle; - if (b != '\0') + mbui_init (iter_haystack, haystack); + for (;; mbui_advance (iter_haystack)) + { + if (!mbui_avail (iter_haystack)) + /* No match. */ + return NULL; + + if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle))) + /* The first character matches. */ + { + mbui_iterator_t rhaystack; + mbui_iterator_t rneedle; + + memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t)); + mbui_advance (rhaystack); + + mbui_init (rneedle, needle); + if (!mbui_avail (rneedle)) + abort (); + mbui_advance (rneedle); + + for (;; mbui_advance (rhaystack), mbui_advance (rneedle)) + { + if (!mbui_avail (rneedle)) + /* Found a match. */ + return (char *) mbui_cur_ptr (iter_haystack); + if (!mbui_avail (rhaystack)) + /* No match. */ + return NULL; + if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle))) + /* Nothing in this round. */ + break; + } + } + } + } + else + return (char *) haystack; + } + else +#endif { - haystack--; /* possible ANSI violation */ - do + if (*needle != '\0') { - c = *++haystack; - if (c == '\0') - goto ret0; - } - while (c != b); + /* Speed up the following searches of needle by caching its first + character. */ + char b = *needle++; - c = *++needle; - if (c == '\0') - goto foundneedle; - ++needle; - goto jin; - - for (;;) - { - register chartype a; - register const unsigned char *rhaystack, *rneedle; - - do + for (;; haystack++) { - a = *++haystack; - if (a == '\0') - goto ret0; - if (a == b) - break; - a = *++haystack; - if (a == '\0') - goto ret0; -shloop:; } - while (a != b); - -jin: a = *++haystack; - if (a == '\0') - goto ret0; - - if (a != c) - goto shloop; - - rhaystack = haystack-- + 1; - rneedle = needle; - a = *rneedle; - - if (*rhaystack == a) - do - { - if (a == '\0') - goto foundneedle; - ++rhaystack; - a = *++needle; - if (*rhaystack != a) - break; - if (a == '\0') - goto foundneedle; - ++rhaystack; - a = *++needle; - } - while (*rhaystack == a); - - needle = rneedle; /* took the register-poor approach */ - - if (a == '\0') - break; - } + if (*haystack == '\0') + /* No match. */ + return NULL; + if (*haystack == b) + /* The first character matches. */ + { + const char *rhaystack = haystack + 1; + const char *rneedle = needle; + + for (;; rhaystack++, rneedle++) + { + if (*rneedle == '\0') + /* Found a match. */ + return (char *) haystack; + if (*rhaystack == '\0') + /* No match. */ + return NULL; + if (*rhaystack != *rneedle) + /* Nothing in this round. */ + break; + } + } + } + } + else + return (char *) haystack; } -foundneedle: - return (char*) haystack; -ret0: - return 0; } Index: m4/canon-host.m4 =================================================================== RCS file: /fetish/cu/m4/canon-host.m4,v retrieving revision 1.5 diff -p -u -r1.5 canon-host.m4 --- m4/canon-host.m4 29 Jan 2005 00:16:39 -0000 1.5 +++ m4/canon-host.m4 22 Sep 2005 06:44:10 -0000 @@ -1,4 +1,4 @@ -# canon-host.m4 serial 6 +# canon-host.m4 serial 7 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,18 +6,11 @@ dnl with or without modifications, as lo AC_DEFUN([gl_CANON_HOST], [ - AC_LIBSOURCES([canon-host.c]) + AC_LIBSOURCES([canon-host.c, canon-host.h]) AC_LIBOBJ([canon-host]) + gl_PREREQ_CANON_HOST +]) - dnl Prerequisites of lib/canon-host.c. - AC_CHECK_HEADERS_ONCE(unistd.h) - AC_CHECK_HEADERS(netdb.h sys/socket.h netinet/in.h arpa/inet.h) - - dnl Add any libraries as early as possible. - dnl In particular, inet_ntoa needs -lnsl at least on Solaris 2.5.1, - dnl so we have to add -lnsl to LIBS before checking for that function. - AC_SEARCH_LIBS(gethostbyname, [inet nsl]) - - dnl These come from -lnsl on Solaris 2.5.1. - AC_CHECK_FUNCS(getaddrinfo gethostbyname gethostbyaddr inet_ntoa) +AC_DEFUN([gl_PREREQ_CANON_HOST], [ + AC_REQUIRE([gl_GETADDRINFO]) ]) Index: m4/getline.m4 =================================================================== RCS file: /fetish/cu/m4/getline.m4,v retrieving revision 1.14 diff -p -u -r1.14 getline.m4 --- m4/getline.m4 29 Jan 2005 00:16:39 -0000 1.14 +++ m4/getline.m4 22 Sep 2005 06:44:11 -0000 @@ -1,4 +1,4 @@ -# getline.m4 serial 12 +# getline.m4 serial 13 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software dnl Foundation, Inc. @@ -13,19 +13,21 @@ dnl See if there's a working, system-sup dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems dnl have a function by that name in -linet that doesn't have anything dnl to do with the function we need. -AC_DEFUN([AM_FUNC_GETLINE], +AC_DEFUN([gl_FUNC_GETLINE], [ AC_LIBSOURCES([getline.c, getline.h]) - dnl Persuade glibc to declare getline() and getdelim(). + dnl Persuade glibc to declare getline(). AC_REQUIRE([AC_GNU_SOURCE]) - am_getline_needs_run_time_check=no + AC_CHECK_DECLS([getline]) + + gl_getline_needs_run_time_check=no AC_CHECK_FUNC(getline, dnl Found it in some library. Verify that it works. - am_getline_needs_run_time_check=yes, + gl_getline_needs_run_time_check=yes, am_cv_func_working_getline=no) - if test $am_getline_needs_run_time_check = yes; then + if test $gl_getline_needs_run_time_check = yes; then AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, [echo fooN |tr -d '\012'|tr N '\012' > conftest.data AC_TRY_RUN([ @@ -57,20 +59,12 @@ AC_DEFUN([AM_FUNC_GETLINE], [Define to a replacement function name for getline().]) AC_LIBOBJ(getline) - # Avoid multiple inclusions of getndelim2.o into LIBOBJS. - # This hack won't be needed after gnulib requires Autoconf 2.58 or later. - case " $LIB@&t@OBJS " in - *" getndelim2.$ac_objext "* ) ;; - *) AC_LIBOBJ(getndelim2);; - esac - gl_PREREQ_GETLINE - gl_PREREQ_GETNDELIM2 fi ]) # Prerequisites of lib/getline.c. AC_DEFUN([gl_PREREQ_GETLINE], [ - AC_CHECK_FUNCS(getdelim) + gl_FUNC_GETDELIM ]) Index: m4/mbrtowc.m4 =================================================================== RCS file: /fetish/cu/m4/mbrtowc.m4,v retrieving revision 1.9 diff -p -u -r1.9 mbrtowc.m4 --- m4/mbrtowc.m4 22 Jan 2005 06:25:53 -0000 1.9 +++ m4/mbrtowc.m4 22 Sep 2005 06:44:11 -0000 @@ -1,5 +1,5 @@ -# mbrtowc.m4 serial 7 -dnl Copyright (C) 2001-2002, 2004 Free Software Foundation, Inc. +# mbrtowc.m4 serial 8 +dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,19 +7,25 @@ dnl with or without modifications, as lo dnl From Paul Eggert dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with -dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere. +dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere. AC_DEFUN([gl_FUNC_MBRTOWC], [ + dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], gl_cv_func_mbrtowc, - [AC_TRY_LINK( - [#include ], - [mbstate_t state; return ! (sizeof state && mbrtowc);], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], gl_cv_func_mbrtowc=yes, gl_cv_func_mbrtowc=no)]) if test $gl_cv_func_mbrtowc = yes; then - AC_DEFINE(HAVE_MBRTOWC, 1, + AC_DEFINE([HAVE_MBRTOWC], 1, [Define to 1 if mbrtowc and mbstate_t are properly declared.]) fi ]) Index: m4/strcase.m4 =================================================================== RCS file: /fetish/cu/m4/strcase.m4,v retrieving revision 1.2 diff -p -u -r1.2 strcase.m4 --- m4/strcase.m4 22 Jan 2005 06:25:53 -0000 1.2 +++ m4/strcase.m4 22 Sep 2005 06:44:11 -0000 @@ -1,5 +1,5 @@ -# strcase.m4 serial 1 -dnl Copyright (C) 2002 Free Software Foundation, Inc. +# strcase.m4 serial 2 +dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,10 +12,11 @@ AC_DEFUN([gl_STRCASE], AC_DEFUN([gl_FUNC_STRCASECMP], [ - AC_REPLACE_FUNCS(strcasecmp) - if test $ac_cv_func_strcasecmp = no; then - gl_PREREQ_STRCASECMP - fi + dnl No known system has a strcasecmp() function that works correctly in + dnl multibyte locales. Therefore we use our version always. + AC_LIBOBJ(strcasecmp) + AC_DEFINE(strcasecmp, rpl_strcasecmp, [Define to rpl_strcasecmp always.]) + gl_PREREQ_STRCASECMP ]) AC_DEFUN([gl_FUNC_STRNCASECMP], @@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_STRNCASECMP], # Prerequisites of lib/strcasecmp.c. AC_DEFUN([gl_PREREQ_STRCASECMP], [ - : + gl_FUNC_MBRTOWC ]) # Prerequisites of lib/strncasecmp.c. Index: m4/strstr.m4 =================================================================== RCS file: /fetish/cu/m4/strstr.m4,v retrieving revision 1.3 diff -p -u -r1.3 strstr.m4 --- m4/strstr.m4 22 Jan 2005 06:25:53 -0000 1.3 +++ m4/strstr.m4 22 Sep 2005 06:44:11 -0000 @@ -1,16 +1,18 @@ -# strstr.m4 serial 2 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +# strstr.m4 serial 4 +dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRSTR], [ - AC_REPLACE_FUNCS(strstr) - if test $ac_cv_func_strstr = no; then - gl_PREREQ_STRSTR - fi + dnl No known system has a strstr() function that works correctly in + dnl multibyte locales. Therefore we use our version always. + AC_LIBOBJ(strstr) + gl_PREREQ_STRSTR ]) # Prerequisites of lib/strstr.c. -AC_DEFUN([gl_PREREQ_STRSTR], [:]) +AC_DEFUN([gl_PREREQ_STRSTR], [ + gl_FUNC_MBRTOWC +]) From MAILER-DAEMON Thu Sep 22 03:07:22 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EILAv-0000vu-9i for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:07:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EILAp-0000ir-Bl for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:07:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EILAl-0000dh-O1 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:07:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EILAj-0000ST-VY for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:07:10 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIL7L-0001Ns-Aj for bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:03:39 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M73c407628 for ; Thu, 22 Sep 2005 00:03:38 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIL7K-000104-Gk for bug-coreutils@gnu.org; Thu, 22 Sep 2005 00:03:38 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Thu, 22 Sep 2005 00:03:38 -0700 Message-ID: <87fyrxlh2t.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: coreutils-proper patches to adjust to recent gnulib changes X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 07:07:17 -0000 I installed this to bring coreutils up to speed with the recent gnulib changes. 2005-09-21 Paul Eggert * lib/Makefile.am (libcoreutils_a_SOURCES): Add getaddrinfo.h, mbchar.c, mbchar.h, mbuiter.h, strcase.h, strlen1.c, strnlen1.h, strstr.h. * m4/check-decl.m4 (_gl_DECL_HEADERS): Don't bother checking for standard C headers, or for headers we no longer use. * m4/jm-macros.m4 (gl_MACROS): Don't require gl_FUNC_XANSTRFTIME; no longer needed. (gl_CHECK_ALL_HEADERS): Don't check for memory.h, mntent.h, mnttab.h, netdb.h, stdlib.h, stdint.h, string.h, sys/filsys.h, sys/fs/s5param.h, sys/fs_types.h, sys/fstyp.h, sys/mntent.h, sys/socket.h, sys/stafs.h, sys/timeb.h, unistd.h. No longer needed. * m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_GETLINE rather than AM_FUNC_GETLINE. Require gl_FUNC_GETPASS_GNU rather than gl_FUNC_GETPASS. Require gl_MBCHAR and gl_MBITER. * src/dircolors.c: Include strcase.h. * src/pinky.c: Include canon-host.h rather than declaring canon_host ourselves. * src/who.c: Likewise. Index: lib/Makefile.am =================================================================== RCS file: /fetish/cu/lib/Makefile.am,v retrieving revision 1.232 diff -p -u -r1.232 Makefile.am --- lib/Makefile.am 16 Sep 2005 07:32:13 -0000 1.232 +++ lib/Makefile.am 22 Sep 2005 06:57:51 -0000 @@ -32,10 +32,16 @@ libcoreutils_a_SOURCES = \ fprintftime.c fprintftime.h \ full-read.c full-read.h \ full-write.c full-write.h \ + getaddrinfo.h \ gettext.h \ localcharset.c localcharset.h \ + mbchar.c mbchar.h \ mbswidth.c mbswidth.h \ + mbuiter.h \ readtokens0.c readtokens0.h \ + strcase.h \ + strnlen1.c strnlen1.h \ + strstr.h \ time_r.c time_r.h \ unicodeio.c unicodeio.h \ verify.h \ Index: m4/check-decl.m4 =================================================================== RCS file: /fetish/cu/m4/check-decl.m4,v retrieving revision 1.33 diff -p -u -r1.33 check-decl.m4 --- m4/check-decl.m4 2 Jul 2005 08:54:13 -0000 1.33 +++ m4/check-decl.m4 22 Sep 2005 06:57:51 -0000 @@ -1,4 +1,4 @@ -#serial 21 +#serial 22 dnl This is just a wrapper function to encapsulate this kludge. dnl Putting it in a separate file like this helps share it between @@ -67,7 +67,5 @@ dnl FIXME: when autoconf has support for dnl This is a little helper so we can require these header checks. AC_DEFUN([_gl_DECL_HEADERS], [ - AC_REQUIRE([AC_HEADER_STDC]) - AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \ - unistd.h sys/time.h utmp.h utmpx.h) + AC_CHECK_HEADERS_ONCE(grp.h pwd.h sys/time.h utmp.h) ]) Index: m4/jm-macros.m4 =================================================================== RCS file: /fetish/cu/m4/jm-macros.m4,v retrieving revision 1.228 diff -p -u -r1.228 jm-macros.m4 --- m4/jm-macros.m4 16 Sep 2005 07:40:02 -0000 1.228 +++ m4/jm-macros.m4 22 Sep 2005 06:57:51 -0000 @@ -1,4 +1,4 @@ -#serial 92 -*- autoconf -*- +#serial 93 -*- autoconf -*- dnl Misc type-related macros for coreutils. @@ -177,45 +177,25 @@ AC_DEFUN([gl_MACROS], AC_REQUIRE([gl_ROOT_DEV_INO]) AC_REQUIRE([gl_VERSION_ETC]) AC_REQUIRE([gl_DIACRIT]) - AC_REQUIRE([gl_FUNC_XANSTRFTIME]) ]) -# These tests must be run before any use of AC_CHECK_TYPE, -# because that macro compiles code that tests e.g., HAVE_UNISTD_H. -# See the definition of ac_includes_default in `configure'. AC_DEFUN([gl_CHECK_ALL_HEADERS], [ AC_CHECK_HEADERS_ONCE( \ hurd.h \ - memory.h \ - mntent.h \ - mnttab.h \ - netdb.h \ paths.h \ priv.h \ - stdlib.h \ - stdint.h \ - string.h \ stropts.h \ - sys/filsys.h \ - sys/fs/s5param.h \ - sys/fs_types.h \ - sys/fstyp.h \ sys/ioctl.h \ - sys/mntent.h \ sys/param.h \ sys/resource.h \ - sys/socket.h \ - sys/statfs.h \ sys/statvfs.h \ sys/systeminfo.h \ sys/time.h \ - sys/timeb.h \ sys/vfs.h \ sys/wait.h \ syslog.h \ termios.h \ - unistd.h \ utime.h \ ) AC_CHECK_HEADERS(sys/mount.h sys/sysctl.h, [], [], Index: m4/prereq.m4 =================================================================== RCS file: /fetish/cu/m4/prereq.m4,v retrieving revision 1.119 diff -p -u -r1.119 prereq.m4 --- m4/prereq.m4 16 Sep 2005 07:40:19 -0000 1.119 +++ m4/prereq.m4 22 Sep 2005 06:57:51 -0000 @@ -1,4 +1,4 @@ -#serial 61 +#serial 62 dnl We use gl_ for non Autoconf macros. m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl @@ -31,10 +31,7 @@ AC_DEFUN([gl_PREREQ], # We don't yet use c-stack.c. # AC_REQUIRE([gl_C_STACK]) - AC_REQUIRE([AM_FUNC_GETLINE]) AC_REQUIRE([AM_STDBOOL_H]) - AC_REQUIRE([gl_FUNC_MKDIR_TRAILING_SLASH]) - AC_REQUIRE([gl_FUNC_MKSTEMP]) AC_REQUIRE([gl_ALLOCSA]) AC_REQUIRE([gl_BACKUPFILE]) AC_REQUIRE([gl_BASENAME]) @@ -58,8 +55,9 @@ AC_DEFUN([gl_PREREQ], AC_REQUIRE([gl_FUNC_DUP2]) AC_REQUIRE([gl_FUNC_FNMATCH_GNU]) AC_REQUIRE([gl_FUNC_GETHOSTNAME]) + AC_REQUIRE([gl_FUNC_GETLINE]) AC_REQUIRE([AC_FUNC_GETLOADAVG]) - AC_REQUIRE([gl_FUNC_GETPASS]) + AC_REQUIRE([gl_FUNC_GETPASS_GNU]) AC_REQUIRE([gl_FUNC_GETUSERSHELL]) AC_REQUIRE([gl_FUNC_LSTAT]) AC_REQUIRE([gl_FUNC_MEMCHR]) @@ -68,7 +66,9 @@ AC_DEFUN([gl_PREREQ], AC_REQUIRE([gl_FUNC_MEMPCPY]) AC_REQUIRE([gl_FUNC_MEMRCHR]) AC_REQUIRE([gl_FUNC_MEMSET]) + AC_REQUIRE([gl_FUNC_MKDIR_TRAILING_SLASH]) AC_REQUIRE([gl_FUNC_MKTIME]) + AC_REQUIRE([gl_FUNC_MKSTEMP]) AC_REQUIRE([gl_FUNC_NONREENTRANT_EUIDACCESS]) AC_REQUIRE([gl_FUNC_READLINK]) AC_REQUIRE([gl_FUNC_RMDIR]) @@ -109,6 +109,8 @@ AC_DEFUN([gl_PREREQ], AC_REQUIRE([gl_LINEBUFFER]) AC_REQUIRE([gl_LOCALCHARSET]) AC_REQUIRE([gl_LONG_OPTIONS]) + AC_REQUIRE([gl_MBCHAR]) + AC_REQUIRE([gl_MBITER]) AC_REQUIRE([gl_MBSWIDTH]) AC_REQUIRE([gl_MD5]) AC_REQUIRE([gl_MEMCOLL]) Index: src/dircolors.c =================================================================== RCS file: /fetish/cu/src/dircolors.c,v retrieving revision 1.91 diff -p -u -r1.91 dircolors.c --- src/dircolors.c 5 Sep 2005 17:11:15 -0000 1.91 +++ src/dircolors.c 22 Sep 2005 06:57:51 -0000 @@ -31,6 +31,7 @@ #include "getline.h" #include "obstack.h" #include "quote.h" +#include "strcase.h" #include "xstrndup.h" /* The official name of this program (e.g., no `g' prefix). */ Index: src/pinky.c =================================================================== RCS file: /fetish/cu/src/pinky.c,v retrieving revision 1.49 diff -p -u -r1.49 pinky.c --- src/pinky.c 2 Jun 2005 05:17:24 -0000 1.49 +++ src/pinky.c 22 Sep 2005 06:57:51 -0000 @@ -25,6 +25,7 @@ #include #include "system.h" +#include "canon-host.h" #include "error.h" #include "hard-locale.h" #include "inttostr.h" @@ -286,7 +287,6 @@ print_entry (const STRUCT_UTMP *utmp_ent #ifdef HAVE_UT_HOST if (include_where && utmp_ent->ut_host[0]) { - extern char *canon_host (); char ut_host[sizeof (utmp_ent->ut_host) + 1]; char *host = NULL; char *display = NULL; Index: src/who.c =================================================================== RCS file: /fetish/cu/src/who.c,v retrieving revision 1.110 diff -p -u -r1.110 who.c --- src/who.c 2 Jun 2005 05:17:24 -0000 1.110 +++ src/who.c 22 Sep 2005 06:57:51 -0000 @@ -31,6 +31,7 @@ #include #include "system.h" +#include "canon-host.h" #include "readutmp.h" #include "error.h" #include "hard-locale.h" @@ -99,7 +100,6 @@ #endif char *ttyname (); -char *canon_host (); /* The name this program was run with. */ char *program_name; From MAILER-DAEMON Thu Sep 22 03:50:00 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EILq7-00020G-Fh for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:49:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIKPe-0004z0-1g for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:18:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIKPY-0004wo-08 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:18:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIKPX-0004le-10 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:18:23 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIKFt-0006B3-M6 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 02:08:29 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8M68L405329 for ; Wed, 21 Sep 2005 23:08:21 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIKFp-0005FS-J0 for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:08:21 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Wed, 21 Sep 2005 23:08:21 -0700 Message-ID: <87br2lmy7e.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailman-Approved-At: Thu, 22 Sep 2005 03:49:34 -0400 Subject: sync from gnulib for minor changes in libraries, m4, etc. X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 06:18:32 -0000 I installed the following changes as part of the process of syncing coreutils from gnulib. These should be straightforward fixes, mostly having to do with "#if HAVE_CONFIG_H" versus "#ifdef HAVE_CONFIG_H" and other minor details like that. 2005-09-21 Paul Eggert * install-sh, config.guess: * __fpending.c, __fpending.h, acl.c, argmatch.c, atexit.c: * backupfile.c, basename.c, calloc.c, canonicalize.c: * chdir-long.c, chown.c, cloexec.c, closeout.c, creat-safer.c: * cycle-check.c, dirfd.c, dirfd.h, dirname.c, dup-safer.c: * dup2.c, euidaccess.c, exclude.c, exitfail.c, fchown-stub.c: * fd-safer.c, file-type.c, fileblocks.c, filemode.c: * filenamecat.c, fnmatch.c, fopen-safer.c, free.c, fsusage.c: * ftruncate.c, full-write.c, getcwd.c, getcwd.h, getdate.h: * getgroups.c, getndelim2.c, getopt1.c, getopt_.h: * gettimeofday.c, getugroups.c, group-member.c, hard-locale.c: * hash-pjw.c, hash.c, human.c, human.h, idcache.c, inttostr.c: * inttostr.h, lchown.c, long-options.c, lstat.c, malloc.c: * memcasecmp.c, memchr.c, memcmp.c, memcoll.c, memcpy.c: * memmove.c, mkdir.c, mkstemp.c, mktime.c, modechange.c: * mountlist.c, nanosleep.c, open-safer.c, openat.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readlink.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, regex_internal.h, rename.c, rmdir.c: * rpmatch.c, safe-read.c, same.c, save-cwd.c, savedir.c: * settime.c, sig2str.c, strcspn.c, stripslash.c, strndup.c: * strnlen.c, strtod.c, strtoimax.c, strtol.c, strverscmp.c: * tempname.c, time_r.c, time_r.h, timespec.h, unicodeio.h: * unistd--.h, unlinkdir.c, userspec.c, utimecmp.c: * version-etc-fsf.c, version-etc.c, xalloc-die.c, xgetcwd.c: * xgethostname.c, xmalloc.c, xmemcoll.c, xnanosleep.c: * xreadlink.c, xstrndup.c, xstrtoimax.c, xstrtol.c: * xstrtoumax.c, yesno.c: * backupfile.m4, bison.m4, calloc.m4: * canonicalize.m4, chown.m4, cloexec.m4, dup2.m4: * fileblocks.m4, free.m4, ftruncate.m4, fts.m4: * getcwd.m4, getopt.m4, getpagesize.m4, getpass.m4: * getugroups.m4, group-member.m4, idcache.m4: * lib-link.m4, lib-prefix.m4, link-follow.m4: * mkdir-p.m4, mkstemp.m4, mktime.m4, mountlist.m4: * nanosleep.m4, onceonly_2_57.m4, pathmax.m4: * physmem.m4, posixver.m4, putenv.m4, safe-read.m4: * same.m4, save-cwd.m4, stdio-safer.m4, strndup.m4: * strnlen.m4, unistd-safer.m4, unlinkdir.m4: * userspec.m4, xreadlink.m4, xstrtod.m4: Sync from gnulib. Index: build-aux/config.guess =================================================================== RCS file: /fetish/cu/build-aux/config.guess,v retrieving revision 1.9 diff -p -u -r1.9 config.guess --- build-aux/config.guess 13 Aug 2005 21:06:17 -0000 1.9 +++ build-aux/config.guess 22 Sep 2005 06:01:36 -0000 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2005-08-03' +timestamp='2005-09-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1185,7 +1185,6 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} Index: build-aux/install-sh =================================================================== RCS file: /fetish/cu/build-aux/install-sh,v retrieving revision 1.3 diff -p -u -r1.3 install-sh --- build-aux/install-sh 13 Aug 2005 21:06:17 -0000 1.3 +++ build-aux/install-sh 22 Sep 2005 06:01:36 -0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-07-09.12 +scriptversion=2005-09-13.16 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,7 +58,21 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -chmodcmd="$chmodprog 0755" +posix_glob= +posix_mkdir= + +# Symbolic mode for testing mkdir with directories. +# It is the same as 755, but also tests that "u+" works. +test_mode=u=rwx,g=rx,o=rx,u+wx + +# Desired mode of installed file. +mode=0755 + +# Desired mode of newly created intermediate directories. +# It is empty if not known yet. +intermediate_mode= + +chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= @@ -111,7 +125,7 @@ while test -n "$1"; do --help) echo "$usage"; exit $?;; - -m) chmodcmd="$chmodprog $2" + -m) mode=$2 shift shift continue;; @@ -164,6 +178,8 @@ if test -z "$1"; then exit 0 fi +test -n "$dir_arg" || trap '(exit $?); exit' 1 2 13 15 + for src do # Protect names starting with `-'. @@ -173,15 +189,11 @@ do if test -n "$dir_arg"; then dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. @@ -208,53 +220,122 @@ do echo "$0: $dstarg: Is a directory" >&2 exit 1 fi - dst=$dst/`basename "$src"` + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? fi fi - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + obsolete_mkdir_used=false - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - case $dstdir in - /*) pathcomp=/ ;; - -*) pathcomp=./ ;; - *) pathcomp= ;; + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + posix_mkdir=false + if $mkdirprog -m $test_mode -p -- / >/dev/null 2>&1; then + posix_mkdir=true + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./-m "$test_mode" ./-p ./-- 2>/dev/null + fi ;; esac - oIFS=$IFS - IFS=/ - set fnord $dstdir - shift - IFS=$oIFS - - for d - do - test "x$d" = x && continue - - pathcomp=$pathcomp$d - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit 1 - fi - pathcomp=$pathcomp/ - done + + if + $posix_mkdir && { + + # With -d, create the new directory with the user-specified mode. + # Otherwise, create it using the same intermediate mode that + # mkdir -p would use when creating intermediate directories. + # POSIX says that this mode is "$(umask -S),u+wx", so use that + # if umask -S works. + + if test -n "$dir_arg"; then + mkdir_mode=$mode + else + case $intermediate_mode in + '') + if umask_S=`(umask -S) 2>/dev/null`; then + intermediate_mode=$umask_S,u+wx + else + intermediate_mode=$test_mode + fi ;; + esac + mkdir_mode=$intermediate_mode + fi + + $mkdirprog -m "$mkdir_mode" -p -- "$dstdir" + } + then : + else + + # mkdir does not conform to POSIX, or it failed possibly due to + # a race condition. Create the directory the slow way, step by + # step, checking for races as we go. + + case $dstdir in + /*) pathcomp=/ ;; + -*) pathcomp=./ ;; + *) pathcomp= ;; + esac + + case $posix_glob in + '') + if (set -f) 2>/dev/null; then + posix_glob=true + else + posix_glob=false + fi ;; + esac + + oIFS=$IFS + IFS=/ + $posix_glob && set -f + set fnord $dstdir + shift + $posix_glob && set +f + IFS=$oIFS + + for d + do + test "x$d" = x && continue + + pathcomp=$pathcomp$d + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # Don't fail if two instances are running concurrently. + test -d "$pathcomp" || exit 1 + fi + pathcomp=$pathcomp/ + done + obsolete_mkdir_used=true + fi fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd "$mode" "$dst"; } || exit 1 else - dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -262,7 +343,6 @@ do # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && @@ -276,10 +356,10 @@ do { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + && { test -z "$chmodcmd" || $doit $chmodcmd "$mode" "$dsttmp"; } && # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not @@ -291,11 +371,12 @@ do # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + if test -f "$dst"; then + $doit $rmcmd -f "$dst" 2>/dev/null \ + || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ + && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else @@ -304,16 +385,13 @@ do } && # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + $doit $mvcmd "$dsttmp" "$dst" } - } - fi || { (exit 1); exit 1; } -done + } || exit 1 -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} + trap - 0 + fi +done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) Index: lib/__fpending.c =================================================================== RCS file: /fetish/cu/lib/__fpending.c,v retrieving revision 1.12 diff -p -u -r1.12 __fpending.c --- lib/__fpending.c 14 May 2005 07:58:06 -0000 1.12 +++ lib/__fpending.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/__fpending.h =================================================================== RCS file: /fetish/cu/lib/__fpending.h,v retrieving revision 1.6 diff -p -u -r1.6 __fpending.h --- lib/__fpending.h 14 Nov 2004 00:19:01 -0000 1.6 +++ lib/__fpending.h 22 Sep 2005 06:01:36 -0000 @@ -1,7 +1,3 @@ -#if HAVE_CONFIG_H -# include -#endif - #include #include Index: lib/acl.c =================================================================== RCS file: /fetish/cu/lib/acl.c,v retrieving revision 1.4 diff -p -u -r1.4 acl.c --- lib/acl.c 2 Jun 2005 05:05:29 -0000 1.4 +++ lib/acl.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,7 @@ Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/argmatch.c =================================================================== RCS file: /fetish/cu/lib/argmatch.c,v retrieving revision 1.36 diff -p -u -r1.36 argmatch.c --- lib/argmatch.c 14 May 2005 07:58:06 -0000 1.36 +++ lib/argmatch.c 22 Sep 2005 06:01:36 -0000 @@ -20,7 +20,7 @@ /* Written by David MacKenzie Modified by Akim Demaille */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/atexit.c =================================================================== RCS file: /fetish/cu/lib/atexit.c,v retrieving revision 1.3 diff -p -u -r1.3 atexit.c --- lib/atexit.c 10 Sep 2003 08:27:55 -0000 1.3 +++ lib/atexit.c 22 Sep 2005 06:01:36 -0000 @@ -1,7 +1,9 @@ /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ /* This function is in the public domain. --Mike Stump. */ -#include "config.h" +#ifdef HAVE_CONFIG_H +# include +#endif int atexit (void (*f) (void)) Index: lib/backupfile.c =================================================================== RCS file: /fetish/cu/lib/backupfile.c,v retrieving revision 1.48 diff -p -u -r1.48 backupfile.c --- lib/backupfile.c 13 Sep 2005 12:12:36 -0000 1.48 +++ lib/backupfile.c 22 Sep 2005 06:01:36 -0000 @@ -21,7 +21,7 @@ /* Written by Paul Eggert and David MacKenzie. Some algorithms adapted from GNU Emacs. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/basename.c =================================================================== RCS file: /fetish/cu/lib/basename.c,v retrieving revision 1.25 diff -p -u -r1.25 basename.c --- lib/basename.c 2 Jun 2005 05:05:29 -0000 1.25 +++ lib/basename.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/calloc.c =================================================================== RCS file: /fetish/cu/lib/calloc.c,v retrieving revision 1.4 diff -p -u -r1.4 calloc.c --- lib/calloc.c 16 Jun 2005 14:52:29 -0000 1.4 +++ lib/calloc.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,7 @@ /* written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef calloc Index: lib/canonicalize.c =================================================================== RCS file: /fetish/cu/lib/canonicalize.c,v retrieving revision 1.23 diff -p -u -r1.23 canonicalize.c --- lib/canonicalize.c 2 Jul 2005 08:41:46 -0000 1.23 +++ lib/canonicalize.c 22 Sep 2005 06:01:36 -0000 @@ -22,17 +22,8 @@ #include "canonicalize.h" -#ifdef STDC_HEADERS -# include -#else -void free (); -#endif - -#if defined STDC_HEADERS || defined HAVE_STRING_H -# include -#else -# include -#endif +#include +#include #if HAVE_SYS_PARAM_H # include Index: lib/chdir-long.c =================================================================== RCS file: /fetish/cu/lib/chdir-long.c,v retrieving revision 1.7 diff -p -u -r1.7 chdir-long.c --- lib/chdir-long.c 14 May 2005 07:58:06 -0000 1.7 +++ lib/chdir-long.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "chdir-long.h" Index: lib/chown.c =================================================================== RCS file: /fetish/cu/lib/chown.c,v retrieving revision 1.15 diff -p -u -r1.15 chown.c --- lib/chown.c 2 Jul 2005 08:41:46 -0000 1.15 +++ lib/chown.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Disable the definition of chown to rpl_chown (from config.h) in this file. Otherwise, we'd get conflicting prototypes for rpl_chown on Index: lib/cloexec.c =================================================================== RCS file: /fetish/cu/lib/cloexec.c,v retrieving revision 1.7 diff -p -u -r1.7 cloexec.c --- lib/cloexec.c 2 Jul 2005 08:41:46 -0000 1.7 +++ lib/cloexec.c 22 Sep 2005 06:01:36 -0000 @@ -1,5 +1,5 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,14 +17,13 @@ The code is taken from glibc/manual/llio.texi */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #include "cloexec.h" #include - #include #ifndef FD_CLOEXEC Index: lib/closeout.c =================================================================== RCS file: /fetish/cu/lib/closeout.c,v retrieving revision 1.20 diff -p -u -r1.20 closeout.c --- lib/closeout.c 14 May 2005 07:58:06 -0000 1.20 +++ lib/closeout.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/creat-safer.c =================================================================== RCS file: /fetish/cu/lib/creat-safer.c,v retrieving revision 1.1 diff -p -u -r1.1 creat-safer.c --- lib/creat-safer.c 27 Aug 2005 20:50:49 -0000 1.1 +++ lib/creat-safer.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/cycle-check.c =================================================================== RCS file: /fetish/cu/lib/cycle-check.c,v retrieving revision 1.6 diff -p -u -r1.6 cycle-check.c --- lib/cycle-check.c 14 May 2005 07:58:06 -0000 1.6 +++ lib/cycle-check.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,7 @@ /* Written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/dirfd.c =================================================================== RCS file: /fetish/cu/lib/dirfd.c,v retrieving revision 1.6 diff -p -u -r1.6 dirfd.c --- lib/dirfd.c 14 May 2005 07:58:06 -0000 1.6 +++ lib/dirfd.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/dirfd.h =================================================================== RCS file: /fetish/cu/lib/dirfd.h,v retrieving revision 1.4 diff -p -u -r1.4 dirfd.h --- lib/dirfd.h 14 May 2005 07:58:06 -0000 1.4 +++ lib/dirfd.h 22 Sep 2005 06:01:36 -0000 @@ -17,10 +17,6 @@ Written by Jim Meyering. */ -#if HAVE_CONFIG_H -# include -#endif - #include #if HAVE_DIRENT_H Index: lib/dirname.c =================================================================== RCS file: /fetish/cu/lib/dirname.c,v retrieving revision 1.35 diff -p -u -r1.35 dirname.c --- lib/dirname.c 2 Jun 2005 05:05:29 -0000 1.35 +++ lib/dirname.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/dup-safer.c =================================================================== RCS file: /fetish/cu/lib/dup-safer.c,v retrieving revision 1.7 diff -p -u -r1.7 dup-safer.c --- lib/dup-safer.c 2 Jul 2005 08:41:46 -0000 1.7 +++ lib/dup-safer.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/dup2.c =================================================================== RCS file: /fetish/cu/lib/dup2.c,v retrieving revision 1.8 diff -p -u -r1.8 dup2.c --- lib/dup2.c 2 Jul 2005 08:41:46 -0000 1.8 +++ lib/dup2.c 22 Sep 2005 06:01:36 -0000 @@ -1,5 +1,5 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,14 +17,12 @@ /* written by Paul Eggert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #include - #include - #include #ifndef F_DUPFD Index: lib/euidaccess.c =================================================================== RCS file: /fetish/cu/lib/euidaccess.c,v retrieving revision 1.23 diff -p -u -r1.23 euidaccess.c --- lib/euidaccess.c 2 Jul 2005 08:41:46 -0000 1.23 +++ lib/euidaccess.c 22 Sep 2005 06:01:36 -0000 @@ -22,7 +22,7 @@ /* Written by David MacKenzie and Torbjorn Granlund. Adapted for GNU C library by Roland McGrath. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/exclude.c =================================================================== RCS file: /fetish/cu/lib/exclude.c,v retrieving revision 1.25 diff -p -u -r1.25 exclude.c --- lib/exclude.c 2 Jun 2005 05:02:14 -0000 1.25 +++ lib/exclude.c 22 Sep 2005 06:01:36 -0000 @@ -20,7 +20,7 @@ /* Written by Paul Eggert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -35,6 +35,7 @@ #include "exclude.h" #include "fnmatch.h" +#include "strcase.h" #include "xalloc.h" #if USE_UNLOCKED_IO Index: lib/exitfail.c =================================================================== RCS file: /fetish/cu/lib/exitfail.c,v retrieving revision 1.4 diff -p -u -r1.4 exitfail.c --- lib/exitfail.c 14 May 2005 07:58:06 -0000 1.4 +++ lib/exitfail.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/fchown-stub.c =================================================================== RCS file: /fetish/cu/lib/fchown-stub.c,v retrieving revision 1.2 diff -p -u -r1.2 fchown-stub.c --- lib/fchown-stub.c 17 Mar 2003 19:21:01 -0000 1.2 +++ lib/fchown-stub.c 22 Sep 2005 06:01:36 -0000 @@ -1,4 +1,6 @@ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include #include Index: lib/fd-safer.c =================================================================== RCS file: /fetish/cu/lib/fd-safer.c,v retrieving revision 1.3 diff -p -u -r1.3 fd-safer.c --- lib/fd-safer.c 2 Jul 2005 08:41:46 -0000 1.3 +++ lib/fd-safer.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/file-type.c =================================================================== RCS file: /fetish/cu/lib/file-type.c,v retrieving revision 1.8 diff -p -u -r1.8 file-type.c --- lib/file-type.c 14 May 2005 07:58:06 -0000 1.8 +++ lib/file-type.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/fileblocks.c =================================================================== RCS file: /fetish/cu/lib/fileblocks.c,v retrieving revision 1.19 diff -p -u -r1.19 fileblocks.c --- lib/fileblocks.c 2 Jul 2005 08:41:46 -0000 1.19 +++ lib/fileblocks.c 22 Sep 2005 06:01:36 -0000 @@ -1,6 +1,7 @@ /* Convert file size to number of blocks on System V-like machines. - Copyright (C) 1990, 1997, 1998, 1999, 2004 Free Software Foundation, Inc. + Copyright (C) 1990, 1997, 1998, 1999, 2004, 2005 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +19,7 @@ /* Written by Brian L. Matthews, blm@6sceng.UUCP. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/filemode.c =================================================================== RCS file: /fetish/cu/lib/filemode.c,v retrieving revision 1.15 diff -p -u -r1.15 filemode.c --- lib/filemode.c 14 May 2005 07:58:06 -0000 1.15 +++ lib/filemode.c 22 Sep 2005 06:01:36 -0000 @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/filenamecat.c =================================================================== RCS file: /fetish/cu/lib/filenamecat.c,v retrieving revision 1.1 diff -p -u -r1.1 filenamecat.c --- lib/filenamecat.c 2 Jun 2005 04:59:10 -0000 1.1 +++ lib/filenamecat.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/fnmatch.c =================================================================== RCS file: /fetish/cu/lib/fnmatch.c,v retrieving revision 1.31 diff -p -u -r1.31 fnmatch.c --- lib/fnmatch.c 2 Jul 2005 10:25:58 -0000 1.31 +++ lib/fnmatch.c 22 Sep 2005 06:01:36 -0000 @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/fopen-safer.c =================================================================== RCS file: /fetish/cu/lib/fopen-safer.c,v retrieving revision 1.6 diff -p -u -r1.6 fopen-safer.c --- lib/fopen-safer.c 3 Jul 2005 07:13:31 -0000 1.6 +++ lib/fopen-safer.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/free.c =================================================================== RCS file: /fetish/cu/lib/free.c,v retrieving revision 1.2 diff -p -u -r1.2 free.c --- lib/free.c 14 May 2005 07:58:06 -0000 1.2 +++ lib/free.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,7 @@ /* written by Paul Eggert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef free Index: lib/fsusage.c =================================================================== RCS file: /fetish/cu/lib/fsusage.c,v retrieving revision 1.53 diff -p -u -r1.53 fsusage.c --- lib/fsusage.c 2 Jul 2005 08:41:46 -0000 1.53 +++ lib/fsusage.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/ftruncate.c =================================================================== RCS file: /fetish/cu/lib/ftruncate.c,v retrieving revision 1.9 diff -p -u -r1.9 ftruncate.c --- lib/ftruncate.c 2 Jul 2005 08:41:46 -0000 1.9 +++ lib/ftruncate.c 22 Sep 2005 06:01:36 -0000 @@ -1,7 +1,7 @@ /* ftruncate emulations that work on some System V's. This file is in the public domain. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/full-write.c =================================================================== RCS file: /fetish/cu/lib/full-write.c,v retrieving revision 1.21 diff -p -u -r1.21 full-write.c --- lib/full-write.c 14 May 2005 07:58:06 -0000 1.21 +++ lib/full-write.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/getcwd.c =================================================================== RCS file: /fetish/cu/lib/getcwd.c,v retrieving revision 1.14 diff -p -u -r1.14 getcwd.c --- lib/getcwd.c 2 Jul 2005 08:41:46 -0000 1.14 +++ lib/getcwd.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif #if !_LIBC Index: lib/getcwd.h =================================================================== RCS file: /fetish/cu/lib/getcwd.h,v retrieving revision 1.3 diff -p -u -r1.3 getcwd.h --- lib/getcwd.h 2 Jul 2005 08:41:46 -0000 1.3 +++ lib/getcwd.h 22 Sep 2005 06:01:36 -0000 @@ -1,6 +1,6 @@ /* Get the working directory, compatibly with the GNU C Library. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,5 +34,7 @@ # define __GETCWD_XCONCAT(x, y) __GETCWD_CONCAT (x, y) # define __GETCWD_ID(y) __GETCWD_XCONCAT (__GETCWD_PREFIX, y) # define getcwd __GETCWD_ID (getcwd) +/* See the POSIX:2001 specification + . */ char *getcwd (char *, size_t); #endif Index: lib/getdate.h =================================================================== RCS file: /fetish/cu/lib/getdate.h,v retrieving revision 1.13 diff -p -u -r1.13 getdate.h --- lib/getdate.h 14 May 2005 07:58:06 -0000 1.13 +++ lib/getdate.h 22 Sep 2005 06:01:36 -0000 @@ -16,10 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include "timespec.h" Index: lib/getgroups.c =================================================================== RCS file: /fetish/cu/lib/getgroups.c,v retrieving revision 1.12 diff -p -u -r1.12 getgroups.c --- lib/getgroups.c 14 May 2005 07:58:06 -0000 1.12 +++ lib/getgroups.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include Index: lib/getndelim2.c =================================================================== RCS file: /fetish/cu/lib/getndelim2.c,v retrieving revision 1.9 diff -p -u -r1.9 getndelim2.c --- lib/getndelim2.c 14 May 2005 07:58:06 -0000 1.9 +++ lib/getndelim2.c 22 Sep 2005 06:01:36 -0000 @@ -20,7 +20,7 @@ /* Originally written by Jan Brittenson, bson@gnu.ai.mit.edu. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/getopt1.c =================================================================== RCS file: /fetish/cu/lib/getopt1.c,v retrieving revision 1.22 diff -p -u -r1.22 getopt1.c --- lib/getopt1.c 14 May 2005 07:58:06 -0000 1.22 +++ lib/getopt1.c 22 Sep 2005 06:01:36 -0000 @@ -18,7 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#include +# include #endif #ifdef _LIBC Index: lib/getopt_.h =================================================================== RCS file: /fetish/cu/lib/getopt_.h,v retrieving revision 1.9 diff -p -u -r1.9 getopt_.h --- lib/getopt_.h 2 Jul 2005 11:56:49 -0000 1.9 +++ lib/getopt_.h 22 Sep 2005 06:01:36 -0000 @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Index: lib/gettimeofday.c =================================================================== RCS file: /fetish/cu/lib/gettimeofday.c,v retrieving revision 1.7 diff -p -u -r1.7 gettimeofday.c --- lib/gettimeofday.c 14 May 2005 07:58:06 -0000 1.7 +++ lib/gettimeofday.c 22 Sep 2005 06:01:36 -0000 @@ -20,7 +20,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Disable the definitions of these functions (from config.h) so we can use the library versions here. */ Index: lib/getugroups.c =================================================================== RCS file: /fetish/cu/lib/getugroups.c,v retrieving revision 1.15 diff -p -u -r1.15 getugroups.c --- lib/getugroups.c 2 Jul 2005 08:41:46 -0000 1.15 +++ lib/getugroups.c 22 Sep 2005 06:01:36 -0000 @@ -1,6 +1,6 @@ /* getugroups.c -- return a list of the groups a user is in - Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003, 2004 Free + Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003, 2004, 2005 Free Software Foundation. This program is free software; you can redistribute it and/or modify Index: lib/group-member.c =================================================================== RCS file: /fetish/cu/lib/group-member.c,v retrieving revision 1.17 diff -p -u -r1.17 group-member.c --- lib/group-member.c 2 Jul 2005 08:41:46 -0000 1.17 +++ lib/group-member.c 22 Sep 2005 06:01:36 -0000 @@ -1,5 +1,5 @@ /* group-member.c -- determine whether group id is in calling user's group list - Copyright (C) 1994, 1997, 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 1998, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/hard-locale.c =================================================================== RCS file: /fetish/cu/lib/hard-locale.c,v retrieving revision 1.11 diff -p -u -r1.11 hard-locale.c --- lib/hard-locale.c 14 May 2005 07:58:06 -0000 1.11 +++ lib/hard-locale.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/hash-pjw.c =================================================================== RCS file: /fetish/cu/lib/hash-pjw.c,v retrieving revision 1.4 diff -p -u -r1.4 hash-pjw.c --- lib/hash-pjw.c 14 May 2005 07:58:06 -0000 1.4 +++ lib/hash-pjw.c 22 Sep 2005 06:01:36 -0000 @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/hash.c =================================================================== RCS file: /fetish/cu/lib/hash.c,v retrieving revision 1.36 diff -p -u -r1.36 hash.c --- lib/hash.c 14 May 2005 07:58:06 -0000 1.36 +++ lib/hash.c 22 Sep 2005 06:01:36 -0000 @@ -24,7 +24,7 @@ /* Define USE_OBSTACK to 1 if you want the allocator to use obstacks instead of malloc. If you change USE_OBSTACK, you have to recompile! */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/human.c =================================================================== RCS file: /fetish/cu/lib/human.c,v retrieving revision 1.33 diff -p -u -r1.33 human.c --- lib/human.c 14 May 2005 07:58:06 -0000 1.33 +++ lib/human.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,7 @@ /* Written by Paul Eggert and Larry McVoy. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/human.h =================================================================== RCS file: /fetish/cu/lib/human.h,v retrieving revision 1.13 diff -p -u -r1.13 human.h --- lib/human.h 2 Jul 2005 08:41:46 -0000 1.13 +++ lib/human.h 22 Sep 2005 06:01:36 -0000 @@ -22,10 +22,6 @@ #ifndef HUMAN_H_ # define HUMAN_H_ 1 -# if HAVE_CONFIG_H -# include -# endif - # include # include Index: lib/idcache.c =================================================================== RCS file: /fetish/cu/lib/idcache.c,v retrieving revision 1.16 diff -p -u -r1.16 idcache.c --- lib/idcache.c 2 Jul 2005 08:41:46 -0000 1.16 +++ lib/idcache.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/inttostr.c =================================================================== RCS file: /fetish/cu/lib/inttostr.c,v retrieving revision 1.2 diff -p -u -r1.2 inttostr.c --- lib/inttostr.c 14 May 2005 07:58:06 -0000 1.2 +++ lib/inttostr.c 22 Sep 2005 06:01:36 -0000 @@ -18,6 +18,9 @@ /* Written by Paul Eggert */ +#ifdef HAVE_CONFIG_H +# include +#endif #include "inttostr.h" /* Convert I to a printable string in BUF, which must be at least Index: lib/inttostr.h =================================================================== RCS file: /fetish/cu/lib/inttostr.h,v retrieving revision 1.5 diff -p -u -r1.5 inttostr.h --- lib/inttostr.h 14 May 2005 07:58:06 -0000 1.5 +++ lib/inttostr.h 22 Sep 2005 06:01:36 -0000 @@ -18,10 +18,6 @@ /* Written by Paul Eggert */ -#if HAVE_CONFIG_H -# include -#endif - #if HAVE_INTTYPES_H # include #endif @@ -29,9 +25,7 @@ # include #endif -#if HAVE_SYS_TYPES_H -# include -#endif +#include #include "intprops.h" Index: lib/lchown.c =================================================================== RCS file: /fetish/cu/lib/lchown.c,v retrieving revision 1.17 diff -p -u -r1.17 lchown.c --- lib/lchown.c 14 May 2005 07:58:06 -0000 1.17 +++ lib/lchown.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include #include Index: lib/long-options.c =================================================================== RCS file: /fetish/cu/lib/long-options.c,v retrieving revision 1.25 diff -p -u -r1.25 long-options.c --- lib/long-options.c 14 May 2005 07:58:06 -0000 1.25 +++ lib/long-options.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/lstat.c =================================================================== RCS file: /fetish/cu/lib/lstat.c,v retrieving revision 1.9 diff -p -u -r1.9 lstat.c --- lib/lstat.c 3 Jul 2005 09:27:38 -0000 1.9 +++ lib/lstat.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* The specification of these functions is in sys_stat.h. But we cannot include this include file here, because on some systems, a Index: lib/malloc.c =================================================================== RCS file: /fetish/cu/lib/malloc.c,v retrieving revision 1.8 diff -p -u -r1.8 malloc.c --- lib/malloc.c 14 May 2005 07:58:06 -0000 1.8 +++ lib/malloc.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef malloc Index: lib/memcasecmp.c =================================================================== RCS file: /fetish/cu/lib/memcasecmp.c,v retrieving revision 1.11 diff -p -u -r1.11 memcasecmp.c --- lib/memcasecmp.c 14 May 2005 07:58:06 -0000 1.11 +++ lib/memcasecmp.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/memchr.c =================================================================== RCS file: /fetish/cu/lib/memchr.c,v retrieving revision 1.21 diff -p -u -r1.21 memchr.c --- lib/memchr.c 14 May 2005 07:58:06 -0000 1.21 +++ lib/memchr.c 22 Sep 2005 06:01:36 -0000 @@ -21,9 +21,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICU GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -USA. */ +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include Index: lib/memcmp.c =================================================================== RCS file: /fetish/cu/lib/memcmp.c,v retrieving revision 1.12 diff -p -u -r1.12 memcmp.c --- lib/memcmp.c 14 May 2005 07:58:06 -0000 1.12 +++ lib/memcmp.c 22 Sep 2005 06:01:36 -0000 @@ -22,7 +22,7 @@ USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif #include Index: lib/memcoll.c =================================================================== RCS file: /fetish/cu/lib/memcoll.c,v retrieving revision 1.12 diff -p -u -r1.12 memcoll.c --- lib/memcoll.c 14 May 2005 07:58:06 -0000 1.12 +++ lib/memcoll.c 22 Sep 2005 06:01:36 -0000 @@ -17,7 +17,7 @@ /* Contributed by Paul Eggert . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/memcpy.c =================================================================== RCS file: /fetish/cu/lib/memcpy.c,v retrieving revision 1.10 diff -p -u -r1.10 memcpy.c --- lib/memcpy.c 14 May 2005 07:58:06 -0000 1.10 +++ lib/memcpy.c 22 Sep 2005 06:01:36 -0000 @@ -16,7 +16,7 @@ /* Written by Jim Meyering . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/memmove.c =================================================================== RCS file: /fetish/cu/lib/memmove.c,v retrieving revision 1.8 diff -p -u -r1.8 memmove.c --- lib/memmove.c 10 Sep 2003 09:03:31 -0000 1.8 +++ lib/memmove.c 22 Sep 2005 06:01:36 -0000 @@ -3,7 +3,7 @@ In the public domain. By David MacKenzie . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/mkdir.c =================================================================== RCS file: /fetish/cu/lib/mkdir.c,v retrieving revision 1.18 diff -p -u -r1.18 mkdir.c --- lib/mkdir.c 14 May 2005 07:58:06 -0000 1.18 +++ lib/mkdir.c 22 Sep 2005 06:01:36 -0000 @@ -19,7 +19,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Disable the definition of mkdir to rpl_mkdir (from config.h) in this file. Otherwise, we'd get conflicting prototypes for rpl_mkdir on Index: lib/mkstemp.c =================================================================== RCS file: /fetish/cu/lib/mkstemp.c,v retrieving revision 1.5 diff -p -u -r1.5 mkstemp.c --- lib/mkstemp.c 2 Jun 2005 05:05:29 -0000 1.5 +++ lib/mkstemp.c 22 Sep 2005 06:01:36 -0000 @@ -15,7 +15,9 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this file. Otherwise, we'd get conflicting prototypes for rpl_mkstemp on Index: lib/mktime.c =================================================================== RCS file: /fetish/cu/lib/mktime.c,v retrieving revision 1.50 diff -p -u -r1.50 mktime.c --- lib/mktime.c 22 Jun 2005 19:07:41 -0000 1.50 +++ lib/mktime.c 22 Sep 2005 06:01:36 -0000 @@ -1,6 +1,5 @@ /* Convert a `struct tm' to a time_t value. Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc. - Inc. This file is part of the GNU C Library. Contributed by Paul Eggert (eggert@twinsun.com). @@ -16,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Define this to have a standalone program to test this implementation of mktime. */ Index: lib/modechange.c =================================================================== RCS file: /fetish/cu/lib/modechange.c,v retrieving revision 1.31 diff -p -u -r1.31 modechange.c --- lib/modechange.c 14 May 2005 07:58:06 -0000 1.31 +++ lib/modechange.c 22 Sep 2005 06:01:37 -0000 @@ -26,7 +26,7 @@ changing the mode of many files, this probably results in a performance gain. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/mountlist.c =================================================================== RCS file: /fetish/cu/lib/mountlist.c,v retrieving revision 1.54 diff -p -u -r1.54 mountlist.c --- lib/mountlist.c 2 Jul 2005 08:41:46 -0000 1.54 +++ lib/mountlist.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/nanosleep.c =================================================================== RCS file: /fetish/cu/lib/nanosleep.c,v retrieving revision 1.16 diff -p -u -r1.16 nanosleep.c --- lib/nanosleep.c 2 Jul 2005 08:41:46 -0000 1.16 +++ lib/nanosleep.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif /* Undefine nanosleep here so any prototype is not redefined to be a prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2) */ Index: lib/open-safer.c =================================================================== RCS file: /fetish/cu/lib/open-safer.c,v retrieving revision 1.4 diff -p -u -r1.4 open-safer.c --- lib/open-safer.c 25 Aug 2005 16:28:18 -0000 1.4 +++ lib/open-safer.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/openat.c =================================================================== RCS file: /fetish/cu/lib/openat.c,v retrieving revision 1.12 diff -p -u -r1.12 openat.c --- lib/openat.c 20 Sep 2005 13:51:01 -0000 1.12 +++ lib/openat.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "openat.h" Index: lib/physmem.c =================================================================== RCS file: /fetish/cu/lib/physmem.c,v retrieving revision 1.13 diff -p -u -r1.13 physmem.c --- lib/physmem.c 2 Jul 2005 08:41:46 -0000 1.13 +++ lib/physmem.c 22 Sep 2005 06:01:37 -0000 @@ -1,5 +1,5 @@ /* Calculate the size of physical memory. - Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/pipe-safer.c =================================================================== RCS file: /fetish/cu/lib/pipe-safer.c,v retrieving revision 1.1 diff -p -u -r1.1 pipe-safer.c --- lib/pipe-safer.c 27 Aug 2005 20:50:42 -0000 1.1 +++ lib/pipe-safer.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/posixtm.c =================================================================== RCS file: /fetish/cu/lib/posixtm.c,v retrieving revision 1.21 diff -p -u -r1.21 posixtm.c --- lib/posixtm.c 3 Jul 2005 21:10:31 -0000 1.21 +++ lib/posixtm.c 22 Sep 2005 06:01:37 -0000 @@ -43,13 +43,6 @@ # include "unlocked-io.h" #endif -/* Use this to suppress gcc's `...may be used before initialized' warnings. */ -#ifdef lint -# define IF_LINT(Code) Code -#else -# define IF_LINT(Code) /* empty */ -#endif - /* ISDIGIT differs from isdigit, as follows: - Its arg may be any int or unsigned int; it need not be an unsigned char. - It's guaranteed to evaluate its argument exactly once. Index: lib/posixver.c =================================================================== RCS file: /fetish/cu/lib/posixver.c,v retrieving revision 1.7 diff -p -u -r1.7 posixver.c --- lib/posixver.c 2 Jul 2005 08:41:46 -0000 1.7 +++ lib/posixver.c 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ /* Which POSIX version to conform to, for utilities. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/putenv.c =================================================================== RCS file: /fetish/cu/lib/putenv.c,v retrieving revision 1.33 diff -p -u -r1.33 putenv.c --- lib/putenv.c 2 Jul 2005 08:41:46 -0000 1.33 +++ lib/putenv.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/quote.c =================================================================== RCS file: /fetish/cu/lib/quote.c,v retrieving revision 1.6 diff -p -u -r1.6 quote.c --- lib/quote.c 14 May 2005 07:58:07 -0000 1.6 +++ lib/quote.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Paul Eggert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/quotearg.c =================================================================== RCS file: /fetish/cu/lib/quotearg.c,v retrieving revision 1.46 diff -p -u -r1.46 quotearg.c --- lib/quotearg.c 31 Aug 2005 07:51:04 -0000 1.46 +++ lib/quotearg.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* Written by Paul Eggert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -222,7 +222,8 @@ quotearg_buffer_restyled (char *buffer, case locale_quoting_style: case clocale_quoting_style: { - /* Get translations for open and closing quotation marks. + /* TRANSLATORS: + Get translations for open and closing quotation marks. The message catalog should translate "`" to a left quotation mark suitable for the locale, and similarly for @@ -235,7 +236,11 @@ quotearg_buffer_restyled (char *buffer, should translate "'" to U+201D (RIGHT DOUBLE QUOTATION MARK). A British English Unicode locale should instead translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and - U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. */ + U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. + + If you don't know what to put here, please see + + and use glyphs suitable for your language. */ char const *left = gettext_quote (N_("`"), quoting_style); char const *right = gettext_quote (N_("'"), quoting_style); Index: lib/raise.c =================================================================== RCS file: /fetish/cu/lib/raise.c,v retrieving revision 1.6 diff -p -u -r1.6 raise.c --- lib/raise.c 2 Jul 2005 08:41:46 -0000 1.6 +++ lib/raise.c 22 Sep 2005 06:01:37 -0000 @@ -1,5 +1,5 @@ /* Provide a non-threads replacement for the POSIX raise function. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,9 @@ /* written by Jim Meyering */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include #include Index: lib/readlink.c =================================================================== RCS file: /fetish/cu/lib/readlink.c,v retrieving revision 1.3 diff -p -u -r1.3 readlink.c --- lib/readlink.c 14 May 2005 07:58:07 -0000 1.3 +++ lib/readlink.c 22 Sep 2005 06:01:37 -0000 @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/readtokens0.c =================================================================== RCS file: /fetish/cu/lib/readtokens0.c,v retrieving revision 1.3 diff -p -u -r1.3 readtokens0.c --- lib/readtokens0.c 14 May 2005 07:58:07 -0000 1.3 +++ lib/readtokens0.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,9 @@ Written by Jim Meyering. */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include #include "readtokens0.h" Index: lib/readutmp.c =================================================================== RCS file: /fetish/cu/lib/readutmp.c,v retrieving revision 1.28 diff -p -u -r1.28 readutmp.c --- lib/readutmp.c 22 Jun 2005 18:26:22 -0000 1.28 +++ lib/readutmp.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,9 @@ /* Written by jla; revised by djm */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "readutmp.h" Index: lib/realloc.c =================================================================== RCS file: /fetish/cu/lib/realloc.c,v retrieving revision 1.10 diff -p -u -r1.10 realloc.c --- lib/realloc.c 14 May 2005 07:58:07 -0000 1.10 +++ lib/realloc.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef realloc Index: lib/regex.c =================================================================== RCS file: /fetish/cu/lib/regex.c,v retrieving revision 1.89 diff -p -u -r1.89 regex.c --- lib/regex.c 9 Sep 2005 21:07:50 -0000 1.89 +++ lib/regex.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #ifdef _LIBC Index: lib/regex_internal.h =================================================================== RCS file: /fetish/cu/lib/regex_internal.h,v retrieving revision 1.3 diff -p -u -r1.3 regex_internal.h --- lib/regex_internal.h 9 Sep 2005 21:07:50 -0000 1.3 +++ lib/regex_internal.h 22 Sep 2005 06:01:37 -0000 @@ -27,6 +27,10 @@ #include #include +#ifndef _LIBC +# include "strcase.h" +#endif + #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC # include #endif @@ -84,11 +88,25 @@ # define RE_ENABLE_I18N #endif +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#if !__GNUC_PREREQ (3, 1) +# define always_inline +#endif + #if __GNUC__ >= 3 # define BE(expr, val) __builtin_expect (expr, val) #else # define BE(expr, val) (expr) # define inline +# define pure #endif /* Number of single byte character. */ Index: lib/rename.c =================================================================== RCS file: /fetish/cu/lib/rename.c,v retrieving revision 1.23 diff -p -u -r1.23 rename.c --- lib/rename.c 2 Jun 2005 05:05:29 -0000 1.23 +++ lib/rename.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* written by Volker Borchert */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef rename Index: lib/rmdir.c =================================================================== RCS file: /fetish/cu/lib/rmdir.c,v retrieving revision 1.15 diff -p -u -r1.15 rmdir.c --- lib/rmdir.c 2 Jun 2005 05:05:29 -0000 1.15 +++ lib/rmdir.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/rpmatch.c =================================================================== RCS file: /fetish/cu/lib/rpmatch.c,v retrieving revision 1.18 diff -p -u -r1.18 rpmatch.c --- lib/rpmatch.c 14 May 2005 07:58:07 -0000 1.18 +++ lib/rpmatch.c 22 Sep 2005 06:01:37 -0000 @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/safe-read.c =================================================================== RCS file: /fetish/cu/lib/safe-read.c,v retrieving revision 1.25 diff -p -u -r1.25 safe-read.c --- lib/safe-read.c 2 Jul 2005 08:41:46 -0000 1.25 +++ lib/safe-read.c 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ /* An interface to read and write that retries after interrupts. - Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004 Free Software + Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/same.c =================================================================== RCS file: /fetish/cu/lib/same.c,v retrieving revision 1.17 diff -p -u -r1.17 same.c --- lib/same.c 2 Jul 2005 08:41:46 -0000 1.17 +++ lib/same.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/save-cwd.c =================================================================== RCS file: /fetish/cu/lib/save-cwd.c,v retrieving revision 1.30 diff -p -u -r1.30 save-cwd.c --- lib/save-cwd.c 3 Jul 2005 07:15:39 -0000 1.30 +++ lib/save-cwd.c 22 Sep 2005 06:01:37 -0000 @@ -19,8 +19,8 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H -# include "config.h" +#ifdef HAVE_CONFIG_H +# include #endif #include "save-cwd.h" Index: lib/savedir.c =================================================================== RCS file: /fetish/cu/lib/savedir.c,v retrieving revision 1.26 diff -p -u -r1.26 savedir.c --- lib/savedir.c 2 Jun 2005 05:05:29 -0000 1.26 +++ lib/savedir.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* Written by David MacKenzie . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/settime.c =================================================================== RCS file: /fetish/cu/lib/settime.c,v retrieving revision 1.5 diff -p -u -r1.5 settime.c --- lib/settime.c 2 Jul 2005 08:41:46 -0000 1.5 +++ lib/settime.c 22 Sep 2005 06:01:37 -0000 @@ -1,5 +1,5 @@ /* settime -- set the system clock - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Index: lib/sig2str.c =================================================================== RCS file: /fetish/cu/lib/sig2str.c,v retrieving revision 1.7 diff -p -u -r1.7 sig2str.c --- lib/sig2str.c 14 May 2005 07:58:07 -0000 1.7 +++ lib/sig2str.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/strcspn.c =================================================================== RCS file: /fetish/cu/lib/strcspn.c,v retrieving revision 1.14 diff -p -u -r1.14 strcspn.c --- lib/strcspn.c 14 May 2005 07:58:07 -0000 1.14 +++ lib/strcspn.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/stripslash.c =================================================================== RCS file: /fetish/cu/lib/stripslash.c,v retrieving revision 1.14 diff -p -u -r1.14 stripslash.c --- lib/stripslash.c 2 Jun 2005 05:05:29 -0000 1.14 +++ lib/stripslash.c 22 Sep 2005 06:01:37 -0000 @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/strndup.c =================================================================== RCS file: /fetish/cu/lib/strndup.c,v retrieving revision 1.11 diff -p -u -r1.11 strndup.c --- lib/strndup.c 14 May 2005 07:58:07 -0000 1.11 +++ lib/strndup.c 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. @@ -18,18 +18,14 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif #include #include -#ifndef HAVE_DECL_STRNLEN -"this configure-time declaration test was not run" -#endif -#if !HAVE_DECL_STRNLEN -size_t strnlen (); -#endif +/* Get strnlen. */ +#include "strnlen.h" #undef __strndup #undef strndup Index: lib/strnlen.c =================================================================== RCS file: /fetish/cu/lib/strnlen.c,v retrieving revision 1.11 diff -p -u -r1.11 strnlen.c --- lib/strnlen.c 14 May 2005 07:58:07 -0000 1.11 +++ lib/strnlen.c 22 Sep 2005 06:01:37 -0000 @@ -16,7 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif #undef strnlen Index: lib/strtod.c =================================================================== RCS file: /fetish/cu/lib/strtod.c,v retrieving revision 1.17 diff -p -u -r1.17 strtod.c --- lib/strtod.c 14 May 2005 07:58:07 -0000 1.17 +++ lib/strtod.c 22 Sep 2005 06:01:37 -0000 @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/strtoimax.c =================================================================== RCS file: /fetish/cu/lib/strtoimax.c,v retrieving revision 1.12 diff -p -u -r1.12 strtoimax.c --- lib/strtoimax.c 14 May 2005 07:58:07 -0000 1.12 +++ lib/strtoimax.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/strtol.c =================================================================== RCS file: /fetish/cu/lib/strtol.c,v retrieving revision 1.22 diff -p -u -r1.22 strtol.c --- lib/strtol.c 14 May 2005 07:58:07 -0000 1.22 +++ lib/strtol.c 22 Sep 2005 06:01:37 -0000 @@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/strverscmp.c =================================================================== RCS file: /fetish/cu/lib/strverscmp.c,v retrieving revision 1.16 diff -p -u -r1.16 strverscmp.c --- lib/strverscmp.c 14 May 2005 07:58:07 -0000 1.16 +++ lib/strverscmp.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/tempname.c =================================================================== RCS file: /fetish/cu/lib/tempname.c,v retrieving revision 1.16 diff -p -u -r1.16 tempname.c --- lib/tempname.c 2 Jul 2005 08:41:46 -0000 1.16 +++ lib/tempname.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/time_r.c =================================================================== RCS file: /fetish/cu/lib/time_r.c,v retrieving revision 1.2 diff -p -u -r1.2 time_r.c --- lib/time_r.c 14 May 2005 07:58:07 -0000 1.2 +++ lib/time_r.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/time_r.h =================================================================== RCS file: /fetish/cu/lib/time_r.h,v retrieving revision 1.2 diff -p -u -r1.2 time_r.h --- lib/time_r.h 14 May 2005 07:58:07 -0000 1.2 +++ lib/time_r.h 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,9 +37,20 @@ # define gmtime_r rpl_gmtime_r # define localtime_r rpl_localtime_r +/* See the POSIX:2001 specification + . */ char *asctime_r (struct tm const * restrict, char * restrict); + +/* See the POSIX:2001 specification + . */ char *ctime_r (time_t const *, char *); + +/* See the POSIX:2001 specification + . */ struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); + +/* See the POSIX:2001 specification + . */ struct tm *localtime_r (time_t const * restrict, struct tm * restrict); #endif Index: lib/timespec.h =================================================================== RCS file: /fetish/cu/lib/timespec.h,v retrieving revision 1.6 diff -p -u -r1.6 timespec.h --- lib/timespec.h 16 Sep 2005 07:39:18 -0000 1.6 +++ lib/timespec.h 22 Sep 2005 06:01:37 -0000 @@ -19,8 +19,6 @@ #if ! defined TIMESPEC_H # define TIMESPEC_H -/* You must include config.h before including this file. */ - # include # if TIME_WITH_SYS_TIME # include Index: lib/unicodeio.h =================================================================== RCS file: /fetish/cu/lib/unicodeio.h,v retrieving revision 1.5 diff -p -u -r1.5 unicodeio.h --- lib/unicodeio.h 14 May 2005 07:58:07 -0000 1.5 +++ lib/unicodeio.h 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ /* Unicode character output to streams with locale dependent encoding. - Copyright (C) 2000-2003 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,19 @@ # include # include +/* Converts the Unicode character CODE to its multibyte representation + in the current locale and calls the SUCCESS callback on the resulting + byte sequence. If an error occurs, invokes the FAILURE callback instead, + passing it CODE and an English error string. + Returns whatever the callback returned. + Assumes that the locale doesn't change between two calls. */ +extern long unicode_to_mb (unsigned int code, + long (*success) (const char *buf, size_t buflen, + void *callback_arg), + long (*failure) (unsigned int code, const char *msg, + void *callback_arg), + void *callback_arg); + /* Outputs the Unicode character CODE to the output stream STREAM. Upon failure, exit if exit_on_error is true, otherwise output a fallback notation. */ Index: lib/unistd--.h =================================================================== RCS file: /fetish/cu/lib/unistd--.h,v retrieving revision 1.1 diff -p -u -r1.1 unistd--.h --- lib/unistd--.h 3 Jul 2005 06:43:07 -0000 1.1 +++ lib/unistd--.h 22 Sep 2005 06:01:37 -0000 @@ -23,3 +23,6 @@ #undef dup #define dup dup_safer + +#undef pipe +#define pipe pipe_safer Index: lib/unlinkdir.c =================================================================== RCS file: /fetish/cu/lib/unlinkdir.c,v retrieving revision 1.3 diff -p -u -r1.3 unlinkdir.c --- lib/unlinkdir.c 2 Jul 2005 08:41:46 -0000 1.3 +++ lib/unlinkdir.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,9 @@ /* Written by Paul Eggert and Jim Meyering. */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "unlinkdir.h" Index: lib/userspec.c =================================================================== RCS file: /fetish/cu/lib/userspec.c,v retrieving revision 1.49 diff -p -u -r1.49 userspec.c --- lib/userspec.c 2 Jul 2005 08:41:46 -0000 1.49 +++ lib/userspec.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Written by David MacKenzie . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/utimecmp.c =================================================================== RCS file: /fetish/cu/lib/utimecmp.c,v retrieving revision 1.4 diff -p -u -r1.4 utimecmp.c --- lib/utimecmp.c 16 Sep 2005 07:39:41 -0000 1.4 +++ lib/utimecmp.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/version-etc-fsf.c =================================================================== RCS file: /fetish/cu/lib/version-etc-fsf.c,v retrieving revision 1.3 diff -p -u -r1.3 version-etc-fsf.c --- lib/version-etc-fsf.c 11 Jul 2005 21:58:50 -0000 1.3 +++ lib/version-etc-fsf.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/version-etc.c =================================================================== RCS file: /fetish/cu/lib/version-etc.c,v retrieving revision 1.23 diff -p -u -r1.23 version-etc.c --- lib/version-etc.c 11 Jul 2005 21:58:32 -0000 1.23 +++ lib/version-etc.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xalloc-die.c =================================================================== RCS file: /fetish/cu/lib/xalloc-die.c,v retrieving revision 1.2 diff -p -u -r1.2 xalloc-die.c --- lib/xalloc-die.c 14 May 2005 07:58:07 -0000 1.2 +++ lib/xalloc-die.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xgetcwd.c =================================================================== RCS file: /fetish/cu/lib/xgetcwd.c,v retrieving revision 1.21 diff -p -u -r1.21 xgetcwd.c --- lib/xgetcwd.c 14 May 2005 07:58:07 -0000 1.21 +++ lib/xgetcwd.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xgethostname.c =================================================================== RCS file: /fetish/cu/lib/xgethostname.c,v retrieving revision 1.24 diff -p -u -r1.24 xgethostname.c --- lib/xgethostname.c 2 Jul 2005 08:41:46 -0000 1.24 +++ lib/xgethostname.c 22 Sep 2005 06:01:37 -0000 @@ -28,7 +28,6 @@ #include #include - #include #include "xalloc.h" Index: lib/xmalloc.c =================================================================== RCS file: /fetish/cu/lib/xmalloc.c,v retrieving revision 1.35 diff -p -u -r1.35 xmalloc.c --- lib/xmalloc.c 22 Jun 2005 11:55:38 -0000 1.35 +++ lib/xmalloc.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xmemcoll.c =================================================================== RCS file: /fetish/cu/lib/xmemcoll.c,v retrieving revision 1.7 diff -p -u -r1.7 xmemcoll.c --- lib/xmemcoll.c 14 May 2005 07:58:07 -0000 1.7 +++ lib/xmemcoll.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Contributed by Paul Eggert . */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xnanosleep.c =================================================================== RCS file: /fetish/cu/lib/xnanosleep.c,v retrieving revision 1.16 diff -p -u -r1.16 xnanosleep.c --- lib/xnanosleep.c 1 Jul 2005 17:25:56 -0000 1.16 +++ lib/xnanosleep.c 22 Sep 2005 06:01:37 -0000 @@ -18,7 +18,7 @@ /* Mostly written (for sleep.c) by Paul Eggert. Factored out (creating this file) by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xreadlink.c =================================================================== RCS file: /fetish/cu/lib/xreadlink.c,v retrieving revision 1.19 diff -p -u -r1.19 xreadlink.c --- lib/xreadlink.c 2 Jul 2005 08:41:46 -0000 1.19 +++ lib/xreadlink.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* Written by Jim Meyering */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xstrndup.c =================================================================== RCS file: /fetish/cu/lib/xstrndup.c,v retrieving revision 1.4 diff -p -u -r1.4 xstrndup.c --- lib/xstrndup.c 14 May 2005 07:58:07 -0000 1.4 +++ lib/xstrndup.c 22 Sep 2005 06:01:37 -0000 @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xstrtoimax.c =================================================================== RCS file: /fetish/cu/lib/xstrtoimax.c,v retrieving revision 1.6 diff -p -u -r1.6 xstrtoimax.c --- lib/xstrtoimax.c 14 May 2005 07:58:07 -0000 1.6 +++ lib/xstrtoimax.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Cloned by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xstrtol.c =================================================================== RCS file: /fetish/cu/lib/xstrtol.c,v retrieving revision 1.37 diff -p -u -r1.37 xstrtol.c --- lib/xstrtol.c 14 May 2005 07:58:07 -0000 1.37 +++ lib/xstrtol.c 22 Sep 2005 06:01:37 -0000 @@ -19,7 +19,7 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/xstrtoumax.c =================================================================== RCS file: /fetish/cu/lib/xstrtoumax.c,v retrieving revision 1.10 diff -p -u -r1.10 xstrtoumax.c --- lib/xstrtoumax.c 14 May 2005 07:58:07 -0000 1.10 +++ lib/xstrtoumax.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: lib/yesno.c =================================================================== RCS file: /fetish/cu/lib/yesno.c,v retrieving revision 1.14 diff -p -u -r1.14 yesno.c --- lib/yesno.c 14 May 2005 07:58:07 -0000 1.14 +++ lib/yesno.c 22 Sep 2005 06:01:37 -0000 @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif Index: m4/backupfile.m4 =================================================================== RCS file: /fetish/cu/m4/backupfile.m4,v retrieving revision 1.8 diff -p -u -r1.8 backupfile.m4 --- m4/backupfile.m4 8 Jul 2005 07:08:56 -0000 1.8 +++ m4/backupfile.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# backupfile.m4 serial 8 +# backupfile.m4 serial 9 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,6 +14,5 @@ AC_DEFUN([gl_BACKUPFILE], AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([AC_SYS_LONG_FILE_NAMES]) - AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_FUNCS_ONCE([pathconf]) ]) Index: m4/bison.m4 =================================================================== RCS file: /fetish/cu/m4/bison.m4,v retrieving revision 1.4 diff -p -u -r1.4 bison.m4 --- m4/bison.m4 23 Jan 2005 09:07:57 -0000 1.4 +++ m4/bison.m4 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ #serial 4 -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -9,5 +9,16 @@ AC_DEFUN([gl_BISON], [ # getdate.y works with bison only. : ${YACC='bison -y'} - AC_SUBST(YACC) +dnl +dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB +dnl requires an Autoconf greater than 2.59c, but it will probably still be +dnl useful to override the description of YACC in the --help output, re +dnl getdate.y assuming `bison -y'. + AC_ARG_VAR(YACC, +[The `Yet Another C Compiler' implementation to use. Defaults to `bison -y'. +Values other than `bison -y' will most likely break on most systems.])dnl + AC_ARG_VAR(YFLAGS, +[YFLAGS contains the list arguments that will be passed by default to Bison. +This script will default YFLAGS to the empty string to avoid a default value of +`-d' given by some make applications.])dnl ]) Index: m4/calloc.m4 =================================================================== RCS file: /fetish/cu/m4/calloc.m4,v retrieving revision 1.5 diff -p -u -r1.5 calloc.m4 --- m4/calloc.m4 23 Jan 2005 09:07:57 -0000 1.5 +++ m4/calloc.m4 22 Sep 2005 06:01:37 -0000 @@ -1,6 +1,6 @@ -# calloc.m4 serial 4 +# calloc.m4 serial 5 -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,7 +18,6 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF], [AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl -AC_CHECK_HEADERS(stdlib.h) AC_CACHE_CHECK([for GNU libc compatible calloc], ac_cv_func_calloc_0_nonnull, [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [exit (!calloc (0, 0) || calloc ((size_t) -1 / 8 + 1, 8));])], Index: m4/canonicalize.m4 =================================================================== RCS file: /fetish/cu/m4/canonicalize.m4,v retrieving revision 1.9 diff -p -u -r1.9 canonicalize.m4 --- m4/canonicalize.m4 18 May 2005 19:29:41 -0000 1.9 +++ m4/canonicalize.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -#serial 8 +#serial 9 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -12,7 +12,6 @@ AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME AC_LIBSOURCES([canonicalize.c, canonicalize.h]) AC_LIBOBJ([canonicalize]) - AC_REQUIRE([AC_HEADER_STDC]) - AC_CHECK_HEADERS(string.h sys/param.h) + AC_CHECK_HEADERS(sys/param.h) AC_CHECK_FUNCS(resolvepath canonicalize_file_name) ]) Index: m4/chown.m4 =================================================================== RCS file: /fetish/cu/m4/chown.m4,v retrieving revision 1.22 diff -p -u -r1.22 chown.m4 --- m4/chown.m4 2 Jul 2005 08:54:13 -0000 1.22 +++ m4/chown.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -#serial 15 +#serial 16 # Determine whether we need the chown wrapper. dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free @@ -79,6 +79,5 @@ AC_DEFUN([gl_FUNC_CHOWN_FOLLOWS_SYMLINK] # Prerequisites of lib/chown.c. AC_DEFUN([gl_PREREQ_CHOWN], [ - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_FUNC([fchown], , [AC_LIBOBJ(fchown-stub)]) ]) Index: m4/cloexec.m4 =================================================================== RCS file: /fetish/cu/m4/cloexec.m4,v retrieving revision 1.4 diff -p -u -r1.4 cloexec.m4 --- m4/cloexec.m4 1 Jul 2005 21:06:08 -0000 1.4 +++ m4/cloexec.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# serial 4 +#serial 5 dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,4 @@ AC_DEFUN([gl_CLOEXEC], [ AC_LIBSOURCES([cloexec.c, cloexec.h]) AC_LIBOBJ([cloexec]) - - dnl Prerequisites of lib/cloexec.c. - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/dup2.m4 =================================================================== RCS file: /fetish/cu/m4/dup2.m4,v retrieving revision 1.3 diff -p -u -r1.3 dup2.m4 --- m4/dup2.m4 1 Jul 2005 21:06:08 -0000 1.3 +++ m4/dup2.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -#serial 3 +#serial 4 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,12 +7,4 @@ dnl with or without modifications, as lo AC_DEFUN([gl_FUNC_DUP2], [ AC_REPLACE_FUNCS(dup2) - if test $ac_cv_func_dup2 = no; then - gl_PREREQ_DUP2 - fi -]) - -# Prerequisites of lib/dup2.c. -AC_DEFUN([gl_PREREQ_DUP2], [ - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/fileblocks.m4 =================================================================== RCS file: /fetish/cu/m4/fileblocks.m4,v retrieving revision 1.2 diff -p -u -r1.2 fileblocks.m4 --- m4/fileblocks.m4 23 Jan 2005 09:07:57 -0000 1.2 +++ m4/fileblocks.m4 22 Sep 2005 06:01:37 -0000 @@ -1,5 +1,5 @@ -# fileblocks.m4 serial 2 -dnl Copyright (C) 2002 Free Software Foundation, Inc. +# fileblocks.m4 serial 3 +dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,5 +15,5 @@ AC_DEFUN([gl_FILEBLOCKS], # Prerequisites of lib/fileblocks.c. AC_DEFUN([gl_PREREQ_FILEBLOCKS], [ - AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h) + AC_CHECK_HEADERS_ONCE(sys/param.h) ]) Index: m4/free.m4 =================================================================== RCS file: /fetish/cu/m4/free.m4,v retrieving revision 1.4 diff -p -u -r1.4 free.m4 --- m4/free.m4 2 Jul 2005 08:54:13 -0000 1.4 +++ m4/free.m4 22 Sep 2005 06:01:37 -0000 @@ -16,7 +16,6 @@ AC_DEFUN([gl_FUNC_FREE], [ - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CACHE_CHECK([whether free (NULL) is known to work], [gl_cv_func_free], [AC_COMPILE_IFELSE( Index: m4/ftruncate.m4 =================================================================== RCS file: /fetish/cu/m4/ftruncate.m4,v retrieving revision 1.8 diff -p -u -r1.8 ftruncate.m4 --- m4/ftruncate.m4 23 Jan 2005 09:07:57 -0000 1.8 +++ m4/ftruncate.m4 22 Sep 2005 06:01:37 -0000 @@ -1,8 +1,8 @@ -#serial 7 +#serial 8 # See if we need to emulate a missing ftruncate function using fcntl or chsize. -# Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,6 +18,5 @@ AC_DEFUN([gl_FUNC_FTRUNCATE], # Prerequisites of lib/ftruncate.c. AC_DEFUN([gl_PREREQ_FTRUNCATE], [ - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_FUNCS(chsize) ]) Index: m4/fts.m4 =================================================================== RCS file: /fetish/cu/m4/fts.m4,v retrieving revision 1.8 diff -p -u -r1.8 fts.m4 --- m4/fts.m4 3 Jul 2005 09:30:00 -0000 1.8 +++ m4/fts.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -#serial 5 +#serial 6 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, Index: m4/getcwd.m4 =================================================================== RCS file: /fetish/cu/m4/getcwd.m4,v retrieving revision 1.9 diff -p -u -r1.9 getcwd.m4 --- m4/getcwd.m4 2 Jul 2005 08:54:13 -0000 1.9 +++ m4/getcwd.m4 22 Sep 2005 06:01:37 -0000 @@ -11,7 +11,6 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], [ AC_LIBSOURCES([getcwd.c, getcwd.h]) - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_TRY_RUN( Index: m4/getopt.m4 =================================================================== RCS file: /fetish/cu/m4/getopt.m4,v retrieving revision 1.9 diff -p -u -r1.9 getopt.m4 --- m4/getopt.m4 10 May 2005 19:09:23 -0000 1.9 +++ m4/getopt.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# getopt.m4 serial 9 +# getopt.m4 serial 11 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,63 +10,71 @@ dnl with or without modifications, as lo AC_DEFUN([gl_GETOPT_SUBSTITUTE], [ - GETOPT_H=getopt.h AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) + gl_GETOPT_SUBSTITUTE_HEADER + gl_PREREQ_GETOPT +]) + +AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], +[ + GETOPT_H=getopt.h AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables should be used.]) AC_SUBST([GETOPT_H]) ]) -AC_DEFUN([gl_GETOPT], +AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ - gl_PREREQ_GETOPT - if test -z "$GETOPT_H"; then - GETOPT_H= AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) - if test -z "$GETOPT_H"; then - AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) - fi + fi - dnl BSD getopt_long uses an incompatible method to reset option processing, - dnl and (as of 2004-10-15) mishandles optional option-arguments. - if test -z "$GETOPT_H"; then - AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) - fi + if test -z "$GETOPT_H"; then + AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) + fi + + dnl BSD getopt_long uses an incompatible method to reset option processing, + dnl and (as of 2004-10-15) mishandles optional option-arguments. + if test -z "$GETOPT_H"; then + AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) + fi - dnl Solaris 10 getopt doesn't handle `+' as a leading character in an - dnl option string (as of 2005-05-05). - if test -z "$GETOPT_H"; then - AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], + dnl Solaris 10 getopt doesn't handle `+' as a leading character in an + dnl option string (as of 2005-05-05). + if test -z "$GETOPT_H"; then + AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], [AC_RUN_IFELSE( - [AC_LANG_PROGRAM([#include ], + [AC_LANG_PROGRAM([#include ], [[ char *myargv[3]; myargv[0] = "conftest"; myargv[1] = "-+"; myargv[2] = 0; return getopt (2, myargv, "+a") != '?'; - ]])], - [gl_cv_func_gnu_getopt=yes], - [gl_cv_func_gnu_getopt=no], - [dnl cross compiling - pessimistically guess based on decls - dnl Solaris 10 getopt doesn't handle `+' as a leading character in an - dnl option string (as of 2005-05-05). - AC_CHECK_DECL([getopt_clip], + ]])], + [gl_cv_func_gnu_getopt=yes], + [gl_cv_func_gnu_getopt=no], + [dnl cross compiling - pessimistically guess based on decls + dnl Solaris 10 getopt doesn't handle `+' as a leading character in an + dnl option string (as of 2005-05-05). + AC_CHECK_DECL([getopt_clip], [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], [#include ])])]) - if test "$gl_cv_func_gnu_getopt" = "no"; then - GETOPT_H=getopt.h - fi - fi - - if test -n "$GETOPT_H"; then - gl_GETOPT_SUBSTITUTE + if test "$gl_cv_func_gnu_getopt" = "no"; then + GETOPT_H=getopt.h fi fi ]) +AC_DEFUN([gl_GETOPT_IFELSE], +[ + AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) + AS_IF([test -n "$GETOPT_H"], [$1], [$2]) +]) + +AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) + # Prerequisites of lib/getopt*. AC_DEFUN([gl_PREREQ_GETOPT], [:]) Index: m4/getpagesize.m4 =================================================================== RCS file: /fetish/cu/m4/getpagesize.m4,v retrieving revision 1.4 diff -p -u -r1.4 getpagesize.m4 --- m4/getpagesize.m4 29 Jan 2005 00:16:39 -0000 1.4 +++ m4/getpagesize.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# getpagesize.m4 serial 4 +# getpagesize.m4 serial 5 dnl Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_GETPAGESIZE], AC_LIBSOURCES([getpagesize.h]) dnl Prerequisites of lib/getpagesize.h. - AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h) + AC_CHECK_HEADERS_ONCE(sys/param.h) AC_CHECK_HEADERS(OS.h) AC_CHECK_FUNCS(getpagesize) ]) Index: m4/getpass.m4 =================================================================== RCS file: /fetish/cu/m4/getpass.m4,v retrieving revision 1.7 diff -p -u -r1.7 getpass.m4 --- m4/getpass.m4 2 May 2005 04:28:20 -0000 1.7 +++ m4/getpass.m4 22 Sep 2005 06:01:37 -0000 @@ -35,7 +35,7 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU], # Prerequisites of lib/getpass.c. AC_DEFUN([gl_PREREQ_GETPASS], [ - AC_CHECK_HEADERS_ONCE(stdio_ext.h) + AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h) + AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr) AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile putc_unlocked]) - : ]) Index: m4/getugroups.m4 =================================================================== RCS file: /fetish/cu/m4/getugroups.m4,v retrieving revision 1.3 diff -p -u -r1.3 getugroups.m4 --- m4/getugroups.m4 29 Jan 2005 00:16:39 -0000 1.3 +++ m4/getugroups.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# getugroups.m4 serial 4 +# getugroups.m4 serial 5 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,5 @@ AC_DEFUN([gl_GETUGROUPS], AC_LIBOBJ([getugroups]) dnl Prerequisites of lib/getugroups.c. - AC_CHECK_HEADERS_ONCE(unistd.h) AC_TYPE_GETGROUPS ]) Index: m4/group-member.m4 =================================================================== RCS file: /fetish/cu/m4/group-member.m4,v retrieving revision 1.9 diff -p -u -r1.9 group-member.m4 --- m4/group-member.m4 29 Jan 2005 00:16:39 -0000 1.9 +++ m4/group-member.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -#serial 8 +#serial 9 # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -25,6 +25,5 @@ AC_DEFUN([gl_FUNC_GROUP_MEMBER], # Prerequisites of lib/group-member.c. AC_DEFUN([gl_PREREQ_GROUP_MEMBER], [ - AC_CHECK_HEADERS_ONCE(unistd.h) AC_REQUIRE([AC_FUNC_GETGROUPS]) ]) Index: m4/idcache.m4 =================================================================== RCS file: /fetish/cu/m4/idcache.m4,v retrieving revision 1.3 diff -p -u -r1.3 idcache.m4 --- m4/idcache.m4 29 Jan 2005 00:16:39 -0000 1.3 +++ m4/idcache.m4 22 Sep 2005 06:01:37 -0000 @@ -1,4 +1,4 @@ -# idcache.m4 serial 4 +# idcache.m4 serial 5 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,4 @@ AC_DEFUN([gl_IDCACHE], [ AC_LIBSOURCES([idcache.c]) AC_LIBOBJ([idcache]) - - dnl Prerequisites of lib/idcache.c. - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/lib-link.m4 =================================================================== RCS file: /fetish/cu/m4/lib-link.m4,v retrieving revision 1.7 diff -p -u -r1.7 lib-link.m4 --- m4/lib-link.m4 21 Mar 2005 07:42:08 -0000 1.7 +++ m4/lib-link.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 6 (gettext-0.14.3) +# lib-link.m4 serial 7 (gettext-0.15) dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -126,6 +126,7 @@ dnl the libraries corresponding to expli dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. @@ -148,7 +149,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ]) else additional_includedir="$withval/include" - additional_libdir="$withval/lib" + additional_libdir="$withval/$acl_libdirstem" fi fi ]) @@ -248,7 +249,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else @@ -334,8 +335,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` additional_includedir="$basedir/include" ;; esac @@ -396,9 +397,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; Index: m4/lib-prefix.m4 =================================================================== RCS file: /fetish/cu/m4/lib-prefix.m4,v retrieving revision 1.5 diff -p -u -r1.5 lib-prefix.m4 --- m4/lib-prefix.m4 26 Feb 2005 07:31:20 -0000 1.5 +++ m4/lib-prefix.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# lib-prefix.m4 serial 4 (gettext-0.14.2) +# lib-prefix.m4 serial 5 (gettext-0.15) dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -24,6 +24,7 @@ AC_DEFUN([AC_LIB_PREFIX], AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes @@ -45,7 +46,7 @@ AC_DEFUN([AC_LIB_PREFIX], ]) else additional_includedir="$withval/include" - additional_libdir="$withval/lib" + additional_libdir="$withval/$acl_libdirstem" fi fi ]) @@ -87,7 +88,7 @@ AC_DEFUN([AC_LIB_PREFIX], dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) @@ -97,7 +98,7 @@ AC_DEFUN([AC_LIB_PREFIX], fi done if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; @@ -151,3 +152,34 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) + +dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing +dnl the basename of the libdir, either "lib" or "lib64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. The current + dnl practice is that on a system supporting 32-bit and 64-bit instruction + dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit + dnl libraries go under $prefix/lib. We determine the compiler's default + dnl mode by looking at the compiler's library search path. If at least + dnl of its elements ends in /lib64 or points to a directory whose absolute + dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the + dnl default, namely "lib". + acl_libdirstem=lib + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi +]) Index: m4/link-follow.m4 =================================================================== RCS file: /fetish/cu/m4/link-follow.m4,v retrieving revision 1.11 diff -p -u -r1.11 link-follow.m4 --- m4/link-follow.m4 2 Jul 2005 08:54:13 -0000 1.11 +++ m4/link-follow.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Run a program to determine whether whether link(2) follows symlinks. dnl Set LINK_FOLLOWS_SYMLINKS accordingly. @@ -13,11 +13,6 @@ AC_DEFUN([gl_AC_FUNC_LINK_FOLLOWS_SYMLIN [whether link(2) dereferences a symlink specified with a trailing slash], jm_ac_cv_func_link_follows_symlink, [ - dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides - dnl the appropriate framework. - test -z "$ac_cv_header_unistd_h" \ - && AC_CHECK_HEADERS(unistd.h) - # Create a regular file. echo > conftest.file AC_TRY_RUN( Index: m4/mkdir-p.m4 =================================================================== RCS file: /fetish/cu/m4/mkdir-p.m4,v retrieving revision 1.1 diff -p -u -r1.1 mkdir-p.m4 --- m4/mkdir-p.m4 2 Jun 2005 04:57:31 -0000 1.1 +++ m4/mkdir-p.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# mkdir-p.m4 serial 8 +# mkdir-p.m4 serial 9 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,5 @@ AC_DEFUN([gl_MKDIR_PARENTS], dnl Prerequisites of lib/mkdir-p.c. AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_CHECK_HEADERS_ONCE(unistd.h) AC_REQUIRE([gl_AFS]) ]) Index: m4/mkstemp.m4 =================================================================== RCS file: /fetish/cu/m4/mkstemp.m4,v retrieving revision 1.19 diff -p -u -r1.19 mkstemp.m4 --- m4/mkstemp.m4 1 Jul 2005 21:06:08 -0000 1.19 +++ m4/mkstemp.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 11 +#serial 12 # Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -65,7 +65,7 @@ AC_DEFUN([gl_PREREQ_MKSTEMP], # Prerequisites of lib/tempname.c. AC_DEFUN([gl_PREREQ_TEMPNAME], [ - AC_CHECK_HEADERS_ONCE(sys/time.h stdint.h unistd.h) + AC_CHECK_HEADERS_ONCE(sys/time.h) AC_CHECK_FUNCS(__secure_getenv gettimeofday) AC_CHECK_DECLS_ONCE(getenv) AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) Index: m4/mktime.m4 =================================================================== RCS file: /fetish/cu/m4/mktime.m4,v retrieving revision 1.22 diff -p -u -r1.22 mktime.m4 --- m4/mktime.m4 2 Jul 2005 08:54:13 -0000 1.22 +++ m4/mktime.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,8 +14,8 @@ dnl From Jim Meyering. # -------------- AC_DEFUN([AC_FUNC_MKTIME], [AC_REQUIRE([AC_HEADER_TIME])dnl -AC_CHECK_HEADERS(stdlib.h sys/time.h unistd.h) -AC_CHECK_FUNCS(alarm) +AC_CHECK_HEADERS_ONCE(sys/time.h) +AC_CHECK_FUNCS_ONCE(alarm) AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime, [AC_RUN_IFELSE([AC_LANG_SOURCE( [[/* Test program from Paul Eggert and Tony Leneis. */ @@ -30,10 +30,7 @@ AC_CACHE_CHECK([for working mktime], ac_ # endif #endif -#if HAVE_STDLIB_H -# include -#endif - +#include #include #if !HAVE_ALARM Index: m4/mountlist.m4 =================================================================== RCS file: /fetish/cu/m4/mountlist.m4,v retrieving revision 1.8 diff -p -u -r1.8 mountlist.m4 --- m4/mountlist.m4 1 Jul 2005 21:06:08 -0000 1.8 +++ m4/mountlist.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 7 +#serial 8 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,6 @@ AC_DEFUN([gl_MOUNTLIST], AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], [ dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h. - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_HEADERS(sys/mntent.h) gl_FSTYPENAME ]) Index: m4/nanosleep.m4 =================================================================== RCS file: /fetish/cu/m4/nanosleep.m4,v retrieving revision 1.20 diff -p -u -r1.20 nanosleep.m4 --- m4/nanosleep.m4 9 Apr 2005 04:53:53 -0000 1.20 +++ m4/nanosleep.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 13 +#serial 14 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -67,6 +67,5 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], # Prerequisites of lib/nanosleep.c. AC_DEFUN([gl_PREREQ_NANOSLEEP], [ - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_FUNCS_ONCE(siginterrupt) ]) Index: m4/onceonly_2_57.m4 =================================================================== RCS file: /fetish/cu/m4/onceonly_2_57.m4,v retrieving revision 1.3 diff -p -u -r1.3 onceonly_2_57.m4 --- m4/onceonly_2_57.m4 21 Mar 2005 20:33:48 -0000 1.3 +++ m4/onceonly_2_57.m4 22 Sep 2005 06:01:38 -0000 @@ -1,5 +1,5 @@ # onceonly_2_57.m4 serial 3 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program @@ -27,7 +27,7 @@ dnl thus reducing the size of 'configure dnl size reduction is ca. 9%. dnl Autoconf version 2.57 or newer is recommended. -AC_PREREQ(2.54) +AC_PREREQ(2.57) # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). Index: m4/pathmax.m4 =================================================================== RCS file: /fetish/cu/m4/pathmax.m4,v retrieving revision 1.3 diff -p -u -r1.3 pathmax.m4 --- m4/pathmax.m4 29 Jan 2005 00:16:39 -0000 1.3 +++ m4/pathmax.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# pathmax.m4 serial 4 +# pathmax.m4 serial 5 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,5 +9,5 @@ AC_DEFUN([gl_PATHMAX], AC_LIBSOURCES([pathmax.h]) dnl Prerequisites of lib/pathmax.h. - AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h) + AC_CHECK_HEADERS_ONCE(sys/param.h) ]) Index: m4/physmem.m4 =================================================================== RCS file: /fetish/cu/m4/physmem.m4,v retrieving revision 1.3 diff -p -u -r1.3 physmem.m4 --- m4/physmem.m4 29 Jan 2005 00:16:39 -0000 1.3 +++ m4/physmem.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# physmem.m4 serial 4 +# physmem.m4 serial 5 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -30,7 +30,6 @@ AC_DEFUN([gl_PHYSMEM], AC_LIBOBJ([physmem]) # Prerequisites of lib/physmem.c. - AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/sysinfo.h \ machine/hal_sysinfo.h sys/table.h sys/param.h sys/sysctl.h \ sys/systemcfg.h],,, [AC_INCLUDES_DEFAULT]) Index: m4/posixver.m4 =================================================================== RCS file: /fetish/cu/m4/posixver.m4,v retrieving revision 1.7 diff -p -u -r1.7 posixver.m4 --- m4/posixver.m4 29 Jan 2005 00:16:39 -0000 1.7 +++ m4/posixver.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# posixver.m4 serial 6 +# posixver.m4 serial 7 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,6 @@ AC_DEFUN([gl_POSIXVER], AC_LIBSOURCES([posixver.c, posixver.h]) AC_LIBOBJ([posixver]) - AC_CHECK_HEADERS_ONCE(unistd.h) AC_REQUIRE([gl_DEFAULT_POSIX2_VERSION]) ]) Index: m4/putenv.m4 =================================================================== RCS file: /fetish/cu/m4/putenv.m4,v retrieving revision 1.14 diff -p -u -r1.14 putenv.m4 --- m4/putenv.m4 23 Jan 2005 09:07:57 -0000 1.14 +++ m4/putenv.m4 22 Sep 2005 06:01:38 -0000 @@ -1,5 +1,5 @@ -# putenv.m4 serial 9 -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# putenv.m4 serial 10 +dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -39,11 +39,5 @@ AC_DEFUN([gl_FUNC_PUTENV], AC_LIBOBJ(putenv) AC_DEFINE(putenv, rpl_putenv, [Define to rpl_putenv if the replacement function should be used.]) - gl_PREREQ_PUTENV fi ]) - -# Prerequisites of lib/putenv.c. -AC_DEFUN([gl_PREREQ_PUTENV], [ - AC_CHECK_HEADERS_ONCE(unistd.h) -]) Index: m4/safe-read.m4 =================================================================== RCS file: /fetish/cu/m4/safe-read.m4,v retrieving revision 1.3 diff -p -u -r1.3 safe-read.m4 --- m4/safe-read.m4 29 Jan 2005 00:16:39 -0000 1.3 +++ m4/safe-read.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# safe-read.m4 serial 3 +# safe-read.m4 serial 4 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,5 +16,4 @@ AC_DEFUN([gl_SAFE_READ], AC_DEFUN([gl_PREREQ_SAFE_READ], [ AC_REQUIRE([gt_TYPE_SSIZE_T]) - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/same.m4 =================================================================== RCS file: /fetish/cu/m4/same.m4,v retrieving revision 1.5 diff -p -u -r1.5 same.m4 --- m4/same.m4 8 Jul 2005 07:08:41 -0000 1.5 +++ m4/same.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# same.m4 serial 5 +# same.m4 serial 6 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,5 @@ AC_DEFUN([gl_SAME], dnl Prerequisites of lib/same.c. AC_REQUIRE([AC_SYS_LONG_FILE_NAMES]) - AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_FUNCS_ONCE([pathconf]) ]) Index: m4/save-cwd.m4 =================================================================== RCS file: /fetish/cu/m4/save-cwd.m4,v retrieving revision 1.7 diff -p -u -r1.7 save-cwd.m4 --- m4/save-cwd.m4 1 Jul 2005 21:06:08 -0000 1.7 +++ m4/save-cwd.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,5 +10,4 @@ AC_DEFUN([gl_SAVE_CWD], AC_LIBOBJ([save-cwd]) dnl Prerequisites for lib/save-cwd.c. AC_CHECK_FUNCS_ONCE(fchdir) - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/stdio-safer.m4 =================================================================== RCS file: /fetish/cu/m4/stdio-safer.m4,v retrieving revision 1.5 diff -p -u -r1.5 stdio-safer.m4 --- m4/stdio-safer.m4 27 Aug 2005 20:40:31 -0000 1.5 +++ m4/stdio-safer.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 4 +#serial 5 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,4 @@ AC_DEFUN([gl_STDIO_SAFER], [ AC_LIBSOURCES([fopen-safer.c, stdio-safer.h, stdio--.h]) AC_LIBOBJ([fopen-safer]) - - dnl Prerequisites of lib/fopen-safer.c. - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/strndup.m4 =================================================================== RCS file: /fetish/cu/m4/strndup.m4,v retrieving revision 1.4 diff -p -u -r1.4 strndup.m4 --- m4/strndup.m4 29 Jan 2005 00:16:39 -0000 1.4 +++ m4/strndup.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -# strndup.m4 serial 4 +# strndup.m4 serial 5 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,6 +18,4 @@ AC_DEFUN([gl_FUNC_STRNDUP], ]) # Prerequisites of lib/strndup.c. -AC_DEFUN([gl_PREREQ_STRNDUP], [ - AC_CHECK_DECLS(strnlen) -]) +AC_DEFUN([gl_PREREQ_STRNDUP], [:]) Index: m4/strnlen.m4 =================================================================== RCS file: /fetish/cu/m4/strnlen.m4,v retrieving revision 1.5 diff -p -u -r1.5 strnlen.m4 --- m4/strnlen.m4 23 Jan 2005 09:07:57 -0000 1.5 +++ m4/strnlen.m4 22 Sep 2005 06:01:38 -0000 @@ -1,11 +1,13 @@ -# strnlen.m4 serial 4 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +# strnlen.m4 serial 5 +dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNLEN], [ + AC_LIBSOURCES([strnlen.c, strnlen.h]) + dnl Persuade glibc to declare strnlen(). AC_REQUIRE([AC_GNU_SOURCE]) @@ -22,4 +24,6 @@ AC_DEFUN([gl_FUNC_STRNLEN], ]) # Prerequisites of lib/strnlen.c. -AC_DEFUN([gl_PREREQ_STRNLEN], [:]) +AC_DEFUN([gl_PREREQ_STRNLEN], [ + AC_CHECK_DECLS_ONCE(strnlen) +]) Index: m4/unistd-safer.m4 =================================================================== RCS file: /fetish/cu/m4/unistd-safer.m4,v retrieving revision 1.6 diff -p -u -r1.6 unistd-safer.m4 --- m4/unistd-safer.m4 27 Aug 2005 20:40:31 -0000 1.6 +++ m4/unistd-safer.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,17 +10,4 @@ AC_DEFUN([gl_UNISTD_SAFER], AC_LIBOBJ([dup-safer]) AC_LIBOBJ([fd-safer]) AC_LIBOBJ([pipe-safer]) - - gl_PREREQ_DUP_SAFER - gl_PREREQ_FD_SAFER -]) - -# Prerequisites of lib/dup-safer.c. -AC_DEFUN([gl_PREREQ_DUP_SAFER], [ - AC_CHECK_HEADERS_ONCE(unistd.h) -]) - -# Prerequisites of lib/fd-safer.c. -AC_DEFUN([gl_PREREQ_FD_SAFER], [ - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/unlinkdir.m4 =================================================================== RCS file: /fetish/cu/m4/unlinkdir.m4,v retrieving revision 1.2 diff -p -u -r1.2 unlinkdir.m4 --- m4/unlinkdir.m4 14 May 2005 10:34:00 -0000 1.2 +++ m4/unlinkdir.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 2 +#serial 3 # Copyright (C) 2005 Free Software Foundation, Inc. # @@ -11,7 +11,7 @@ AC_DEFUN([gl_UNLINKDIR], [ AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADERS_ONCE(priv.h unistd.h) + AC_CHECK_HEADERS_ONCE(priv.h) AC_LIBSOURCES([unlinkdir.c, unlinkdir.h]) AC_LIBOBJ([unlinkdir]) Index: m4/userspec.m4 =================================================================== RCS file: /fetish/cu/m4/userspec.m4,v retrieving revision 1.6 diff -p -u -r1.6 userspec.m4 --- m4/userspec.m4 9 Mar 2005 23:05:32 -0000 1.6 +++ m4/userspec.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 7 +#serial 8 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,5 +10,5 @@ AC_DEFUN([gl_USERSPEC], AC_LIBOBJ([userspec]) dnl Prerequisites of lib/userspec.c. - AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h) + AC_CHECK_HEADERS_ONCE(sys/param.h) ]) Index: m4/xreadlink.m4 =================================================================== RCS file: /fetish/cu/m4/xreadlink.m4,v retrieving revision 1.4 diff -p -u -r1.4 xreadlink.m4 --- m4/xreadlink.m4 23 Jun 2005 16:24:06 -0000 1.4 +++ m4/xreadlink.m4 22 Sep 2005 06:01:38 -0000 @@ -1,4 +1,4 @@ -#serial 6 +#serial 7 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,5 +11,4 @@ AC_DEFUN([gl_XREADLINK], dnl Prerequisites of lib/xreadlink.c. AC_REQUIRE([gt_TYPE_SSIZE_T]) - AC_CHECK_HEADERS_ONCE(unistd.h) ]) Index: m4/xstrtod.m4 =================================================================== RCS file: /fetish/cu/m4/xstrtod.m4,v retrieving revision 1.4 diff -p -u -r1.4 xstrtod.m4 --- m4/xstrtod.m4 23 Jun 2005 18:42:29 -0000 1.4 +++ m4/xstrtod.m4 22 Sep 2005 06:01:38 -0000 @@ -1,5 +1,5 @@ #serial 4 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. From MAILER-DAEMON Thu Sep 22 03:49:55 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EILq5-0001zx-Q4 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 03:49:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIIER-00013r-NE for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:58:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIIEO-00010h-9L for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:58:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIIEM-0000RS-Ud for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:58:43 -0400 Received: from [64.233.162.204] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIHsD-0006IU-9x for bug-coreutils@gnu.org; Wed, 21 Sep 2005 23:35:49 -0400 Received: by zproxy.gmail.com with SMTP id x7so75643nzc for ; Wed, 21 Sep 2005 20:35:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=exCwQObtrqOHI+wGSskH3ZcW9UVG0W/PbhzebKscEJ5/gH+AT9D79FqvejrJJqYmgpcn5uy466118TS3jX9E3nTd/gPhXMmJ/6//jVahuIWikBtN9PlWG3Nx6h3BLFfN+m/nxr77t0H5SFZF9AfRupPOvKDXaFrE0WApALhygzo= Received: by 10.54.49.17 with SMTP id w17mr2941151wrw; Wed, 21 Sep 2005 20:35:48 -0700 (PDT) Received: by 10.54.119.20 with HTTP; Wed, 21 Sep 2005 20:35:47 -0700 (PDT) Message-ID: Date: Thu, 22 Sep 2005 09:05:47 +0530 From: Prashant Jha To: bug-coreutils@gnu.org MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 22 Sep 2005 03:49:32 -0400 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Problems with tee command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Prashant Jha List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 03:58:49 -0000 X-List-Received-Date: Thu, 22 Sep 2005 03:58:49 -0000 Hello - I am an IT Professional working on Unix (Solaris 5.8). I would like to report the following error and request some information regarding the same. There is a script with a line similar to - echo `The World is not Enough` | tee -a Logs.txt While this script works fine generally...In some cases the script just hangs a 'ps -ef' shows the tee command to be executing for hours. What does this mean and why does this occur? Any information would be a great help. Thanks and Regards, Prashant Jha From MAILER-DAEMON Thu Sep 22 06:18:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIOA8-0007fa-V7 for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 06:18:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIO9w-0007et-9x for bug-coreutils@gnu.org; Thu, 22 Sep 2005 06:18:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIO9t-0007eO-PZ for bug-coreutils@gnu.org; Thu, 22 Sep 2005 06:18:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIO2I-0005e7-5N for bug-coreutils@gnu.org; Thu, 22 Sep 2005 06:10:38 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EINf9-0005gp-6s for bug-coreutils@gnu.org; Thu, 22 Sep 2005 05:47:49 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id F1416CF6; Thu, 22 Sep 2005 11:45:10 +0200 (CEST) From: Jim Meyering To: Chris Frey In-Reply-To: <20050921184549.GA25767@netdirect.ca> (Chris Frey's message of "Wed, 21 Sep 2005 14:45:49 -0400") References: <20050914121407.GA9040@netdirect.ca> <20050921184549.GA25767@netdirect.ca> Date: Thu, 22 Sep 2005 11:45:10 +0200 Message-ID: <87d5n1fnbt.fsf@rho.meyering.net> Lines: 79 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: [PATCH] split: adding --exec, --exec-wait, and --pause X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 10:18:42 -0000 Chris Frey wrote: > I haven't seen any comments on this patch yet. What can I do to help get > this patch included in coreutils? Thanks for the feature-adding patch. Adding a new feature to a classic program in the coreutils package is not something we do lightly. There has to be a pretty good reason and no easy workaround or alternative tool. In this case, what's the motivation? Saving disk space? Please provide examples showing how this is useful to you. In your typical applications, are you splitting an existing file or data from an input pipe? If it's always an existing file, then perhaps a simpler change (not involving exec, user interaction, etc.) would be to provide an option to split telling it to extract only the Nth hunk from its input file. Then the iteration and user interaction could happen outside of split. Here are some guidelines: - base your changes on the latest code in CVS, here: http://savannah.gnu.org/cvs/?group=coreutils - add tests to exercise the new functionality, as well as tests that exercise it in combination with related options. The more the better. - follow the guidelines in the GNU Coding Standards (standards.info) which is distributed as part of the autoconf package. - include changes to the texinfo documentation, and be sure to update the --help output. - finally, if the change is `significant' you'll have to send signed copyright assignment papers to the FSF If a few people say that your patch is essential to them, that helps to accelerate the process. For now, I'll probably start a cvs-only patches/ directory and begin putting candidate *.diff files there. ------------------ Regarding your patch, here's a relatively shallow review: We rarely add new short-named options (-e, -w, -p), so if you want to continue with this, please remove those. You should handle a few more failed system/library calls. Uses of at least read, write, close, dup2 and asprintf are unchecked. Don't hard-code /bin/sh. > + execl ("/bin/sh", "/bin/sh", "-c", cmd_line, NULL); At least pull it out into a #define: Is ttyname_r portable? Here, it's probably better to use ttyname. An alternative would be to undo the recent change that made split reuse stdin. That'd probably be better, since most other programs in coreutils read user input from stdin. Re this: > + /* build the command line, passing a few filenames so the user > + * can use multiple %s if he needs to... the cheap way */ > + asprintf (&cmd_line, exec_command, outfile, outfile, outfile, outfile, > + outfile, outfile, outfile); The file names may have to be quoted. The prefix may contain shell meta-characters. What if exec_command contains more than seven %s's? Given the relative complexity (in number of syscalls) of the exec-and-prompt-from-within-split approach, I think you can see why I'd prefer to consider the simpler approach. Finally, don't expect quick feedback. Adding a feature like this is low priority. From MAILER-DAEMON Thu Sep 22 11:35:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIT4c-0006q9-Ok for mharc-bug-coreutils@gnu.org; Thu, 22 Sep 2005 11:33:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIT4T-0006jM-EQ for bug-coreutils@gnu.org; Thu, 22 Sep 2005 11:33:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIT4K-0006fH-E5 for bug-coreutils@gnu.org; Thu, 22 Sep 2005 11:33:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIT4I-0006QD-HH for bug-coreutils@gnu.org; Thu, 22 Sep 2005 11:33:02 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIStl-0002Ah-3g for bug-coreutils@gnu.org; Thu, 22 Sep 2005 11:22:09 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 54C654B2E8; Thu, 22 Sep 2005 09:22:08 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 492C72CB25; Thu, 22 Sep 2005 09:22:08 -0600 (MDT) Date: Thu, 22 Sep 2005 09:22:08 -0600 To: Prashant Jha Message-ID: <20050922152208.GA12809@dementia.proulx.com> Mail-Followup-To: Prashant Jha , bug-coreutils@gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: Problems with tee command X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 15:33:18 -0000 Prashant Jha wrote: > I am an IT Professional working on Unix (Solaris 5.8). > I would like to report the following error and request some information > regarding the same. > There is a script with a line similar to - > echo `The World is not Enough` | tee -a Logs.txt Hopefully that is similar and not exact. You are using `...` here which are backticks instead of '...' single quotes. Using backticks executes commands in the string. You want the string quoted instead. Hopefully this is a typo. echo 'The World is not Enough' | tee -a Logs.txt > While this script works fine generally...In some cases the script just > hangs a 'ps -ef' shows the > tee command to be executing for hours. > What does this mean and why does this occur? > Any information would be a great help. This should never hang. Therefore it must be an outside influence. Is the Logs.txt file on a network attached filesystem? I will guess that it is and that the delay comes from there. Try repeating the behavior on a local filesystem. The 'tee' program reads input and writes the data both to the standard output passing it along and also to any listed files. It does this by calling the system write(2) kernel routine. This is an I/O process external to the tee program. If the tee program is getting blocked on I/O in the kernel and showing up in the ps listing then I can only guess that this is writing to a network device and the networked device is "blocking". I guess this because a local disk device should never block. I would investigate this aspect of the problem. Other than this I am not sure what to suggest. Bob From MAILER-DAEMON Fri Sep 23 01:24:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIg3D-0003ns-1T for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 01:24:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIg2d-0003hB-MZ for bug-coreutils@gnu.org; Fri, 23 Sep 2005 01:24:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIg2V-0003cz-8F for bug-coreutils@gnu.org; Fri, 23 Sep 2005 01:24:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIg2T-0003ZD-Kh; Fri, 23 Sep 2005 01:24:01 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIftD-0000TG-OE; Fri, 23 Sep 2005 01:14:28 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8N5EQ429055; Thu, 22 Sep 2005 22:14:26 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIftC-0003aK-4H; Thu, 22 Sep 2005 22:14:26 -0700 To: ericblake@comcast.net (Eric Blake) References: <092220052339.28533.433340AA000D5B7B00006F7522007374780A050E040D0C079D0A@comcast.net> From: Paul Eggert Date: Thu, 22 Sep 2005 22:14:26 -0700 In-Reply-To: <092220052339.28533.433340AA000D5B7B00006F7522007374780A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Thu, 22 Sep 2005 23:39:23 +0000") Message-ID: <873bnwxt59.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org Subject: Re: bug in getaddrinfo module X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 05:24:15 -0000 ericblake@comcast.net (Eric Blake) writes: > gcc -DHAVE_CONFIG_H -I. -I../../lib -I.. -g -O2 -c ../../lib/getaddrinfo.c > ../../lib/getaddrinfo.c: In function `getaddrinfo': > ../../lib/getaddrinfo.c:112: error: invalid application of `sizeof' to incomplete type `sockaddr_in' Thanks for reporting that. Aside from the missing that you mentioned, I noticed a few other glitches. I installed the following fix into coreutils; does it fix things for you? If so, it should be propagated into gnulib. 2005-09-22 Paul Eggert * lib/getaddrinfo.c [HAVE_NETINET_IN_H]: Include . Problem reported by Eric Blake. (getaddrinfo): Initialize se so that it's not garbage. Redo internal storage allocation so that it doesn't make unportable assumptions about alignment. Fix a memory leak. * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Check for netinet/in.h. Index: lib/getaddrinfo.c =================================================================== RCS file: /fetish/cu/lib/getaddrinfo.c,v retrieving revision 1.1 diff -p -u -r1.1 getaddrinfo.c --- lib/getaddrinfo.c 22 Sep 2005 06:22:44 -0000 1.1 +++ lib/getaddrinfo.c 23 Sep 2005 05:06:24 -0000 @@ -22,6 +22,10 @@ #include "getaddrinfo.h" +#if HAVE_NETINET_IN_H +# include +#endif + /* Get calloc. */ #include @@ -62,9 +66,22 @@ getaddrinfo (const char *restrict nodena struct addrinfo **restrict res) { struct addrinfo *tmp; - struct servent *se; + struct servent *se = NULL; struct hostent *he; - size_t sinlen; + void *storage; + size_t size; +#if HAVE_IPV6 + struct v6_pair { + struct addrinfo addrinfo; + struct sockaddr_in6 sockaddr_in6; + }; +#endif +#if HAVE_IPV4 + struct v4_pair { + struct addrinfo addrinfo; + struct sockaddr_in sockaddr_in; + }; +#endif if (hints && (hints->ai_flags & ~AI_CANONNAME)) /* FIXME: Support more flags. */ @@ -103,13 +120,13 @@ getaddrinfo (const char *restrict nodena { #if HAVE_IPV6 case PF_INET6: - sinlen = sizeof (struct sockaddr_in6); + size = sizeof (struct v6_pair); break; #endif #if HAVE_IPV4 case PF_INET: - sinlen = sizeof (struct sockaddr_in); + size = sizeof (struct v4_pair); break; #endif @@ -117,8 +134,8 @@ getaddrinfo (const char *restrict nodena return EAI_NODATA; } - tmp = calloc (1, sizeof (*tmp) + sinlen); - if (!tmp) + storage = calloc (1, size); + if (!storage) return EAI_MEMORY; switch (he->h_addrtype) @@ -126,18 +143,23 @@ getaddrinfo (const char *restrict nodena #if HAVE_IPV6 case PF_INET6: { - struct sockaddr_in6 *sinp = (char *) tmp + sizeof (*tmp); + struct v6_pair *p = storage; + struct sockaddr_in6 *sinp = &p->sockaddr_in6; + tmp = &p->addrinfo; if (se) sinp->sin6_port = se->s_port; if (he->h_length != sizeof (sinp->sin6_addr)) - return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ + { + free (storage); + return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ + } - memcpy (&sinp->sin6_addr, he->h_addr_list[0], he->h_length); + memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr); tmp->ai_addr = (struct sockaddr *) sinp; - tmp->ai_addrlen = sinlen; + tmp->ai_addrlen = sizeof *sinp; } break; #endif @@ -145,24 +167,29 @@ getaddrinfo (const char *restrict nodena #if HAVE_IPV4 case PF_INET: { - struct sockaddr_in *sinp = (char *) tmp + sizeof (*tmp); + struct v4_pair *p = storage; + struct sockaddr_in *sinp = &p->sockaddr_in; + tmp = &p->addrinfo; if (se) sinp->sin_port = se->s_port; if (he->h_length != sizeof (sinp->sin_addr)) - return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ + { + free (storage); + return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ + } - memcpy (&sinp->sin_addr, he->h_addr_list[0], he->h_length); + memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr); tmp->ai_addr = (struct sockaddr *) sinp; - tmp->ai_addrlen = sinlen; + tmp->ai_addrlen = sizeof *sinp; } break; #endif default: - free (tmp); + free (storage); return EAI_NODATA; } @@ -177,7 +204,7 @@ getaddrinfo (const char *restrict nodena tmp->ai_canonname = strdup (cn); if (!tmp->ai_canonname) { - free (tmp); + free (storage); return EAI_MEMORY; } } Index: m4/getaddrinfo.m4 =================================================================== RCS file: /fetish/cu/m4/getaddrinfo.m4,v retrieving revision 1.1 diff -p -u -r1.1 getaddrinfo.m4 --- m4/getaddrinfo.m4 22 Sep 2005 06:22:44 -0000 1.1 +++ m4/getaddrinfo.m4 23 Sep 2005 05:06:24 -0000 @@ -1,5 +1,5 @@ -# getaddrinfo.m4 serial 3 -dnl Copyright (C) 2004 Free Software Foundation, Inc. +# getaddrinfo.m4 serial 4 +dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -16,4 +16,5 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([AC_C_INLINE]) + AC_CHECK_HEADERS_ONCE([netinet/in.h]) ]) From MAILER-DAEMON Fri Sep 23 09:23:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EInWc-0002wr-1s for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 09:23:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EInWT-0002t6-Ij for bug-coreutils@gnu.org; Fri, 23 Sep 2005 09:23:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EInWK-0002pL-4g for bug-coreutils@gnu.org; Fri, 23 Sep 2005 09:23:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EInWC-0002jB-Oz; Fri, 23 Sep 2005 09:23:13 -0400 Received: from [63.240.76.28] (helo=sccrmhc13.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EInPo-0002KJ-Ar; Fri, 23 Sep 2005 09:16:36 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc13) with ESMTP id <2005092313163501300aakmqe>; Fri, 23 Sep 2005 13:16:35 +0000 Message-ID: <43340031.1020805@byu.net> Date: Fri, 23 Sep 2005 07:16:33 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Paul Eggert References: <092220052339.28533.433340AA000D5B7B00006F7522007374780A050E040D0C079D0A@comcast.net> <873bnwxt59.fsf@penguin.cs.ucla.edu> In-Reply-To: <873bnwxt59.fsf@penguin.cs.ucla.edu> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org Subject: Re: bug in getaddrinfo module X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 13:23:32 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Paul Eggert on 9/22/2005 11:14 PM: > Thanks for reporting that. Aside from the missing > that you mentioned, I noticed a few other glitches. > > I installed the following fix into coreutils; does it fix things for > you? If so, it should be propagated into gnulib. Works fine. Thanks for the quick fix. - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDNAAx84KuGfSFAYARAonzAJ9/OfsWJye2/j2kUCucGRzWXyGTtwCcDyyQ I9oCpvNXJQjGVFqUEZsJXRI= =4DXP -----END PGP SIGNATURE----- From MAILER-DAEMON Fri Sep 23 11:19:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIpKp-0002iX-89 for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 11:19:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIjMn-0006Cl-Ra for bug-coreutils@gnu.org; Fri, 23 Sep 2005 04:57:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIjAB-0005h5-PH for bug-coreutils@gnu.org; Fri, 23 Sep 2005 04:44:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIiy1-0004vD-IY for bug-coreutils@gnu.org; Fri, 23 Sep 2005 04:31:37 -0400 Received: from [130.161.131.5] (helo=mailservice.tudelft.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIias-0003Y9-QO for bug-coreutils@gnu.org; Fri, 23 Sep 2005 04:07:42 -0400 Received: from localhost (localhost [127.0.0.1]) by rav.antivirus (Postfix) with ESMTP id A237D80361 for ; Fri, 23 Sep 2005 10:07:41 +0200 (CEST) Received: from aglu.demon.nl (x080.decis.nl [130.161.177.80]) by mx4.tudelft.nl (Postfix) with ESMTP id 30FCC80351 for ; Fri, 23 Sep 2005 10:07:41 +0200 (CEST) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by aglu.demon.nl (Postfix) with ESMTP id CBF5D3FE48 for ; Fri, 23 Sep 2005 10:07:06 +0200 (CEST) Message-ID: <4333B7AA.5060108@yahoo.co.uk> Date: Fri, 23 Sep 2005 10:07:06 +0200 From: Thomas Hood User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bug-coreutils@gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at tudelft.nl X-Mailman-Approved-At: Fri, 23 Sep 2005 11:19:33 -0400 Subject: New stable release? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 09:01:17 -0000 Hi. Does anyone have any idea about when there might be a new stable release of coreutils? -- Thomas Hood From MAILER-DAEMON Fri Sep 23 12:00:56 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIpyo-0004OX-QU for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:00:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIpyl-0004Mx-VV for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:00:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIpyh-0004K4-EU for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:00:47 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIpyg-0004He-OI for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:00:46 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIpwv-0007mk-Pw for bug-coreutils@gnu.org; Fri, 23 Sep 2005 11:58:58 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 729E6C89; Fri, 23 Sep 2005 17:58:56 +0200 (CEST) From: Jim Meyering To: Thomas Hood In-Reply-To: <4333B7AA.5060108@yahoo.co.uk> (Thomas Hood's message of "Fri, 23 Sep 2005 10:07:06 +0200") References: <4333B7AA.5060108@yahoo.co.uk> Date: Fri, 23 Sep 2005 17:58:56 +0200 Message-ID: <87slvv93nj.fsf@rho.meyering.net> Lines: 5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: New stable release? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 16:00:53 -0000 > Hi. Does anyone have any idea about when there might be a new stable > release of coreutils? There will be a new test release soon. There have been far too many changes to call it stable right away. From MAILER-DAEMON Fri Sep 23 15:23:30 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIt8p-00059B-UG for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 15:23:28 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIt8e-00053p-Jw for bug-coreutils@gnu.org; Fri, 23 Sep 2005 15:23:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIt8Y-0004yx-W3 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 15:23:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIt8X-0004w1-Ob; Fri, 23 Sep 2005 15:23:09 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIt5d-0005M2-Ml; Fri, 23 Sep 2005 15:20:09 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8NJK8413857; Fri, 23 Sep 2005 12:20:08 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIt5c-0007zB-Dd; Fri, 23 Sep 2005 12:20:08 -0700 To: bug-gnulib@gnu.org, bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 23 Sep 2005 12:20:08 -0700 Message-ID: <87zmq34mmv.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: utimens port to Solaris 10 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 19:23:21 -0000 I installed the following into both gnulib and coreutils, to port the utimens module to Solaris 10, which has yet another primitive for setting file time stamps (and yet another primitive that can't do it to full resolution! When will these guys learn?). 2005-09-23 Paul Eggert * lib/utimens.c (futimens): Use futimesat if available. Prefer it to futimes since it doesn't have the futimes bug. * m4/utimens.m4 (gl_UTIMENS): Check for futimesat. Index: lib/utimens.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/utimens.c,v retrieving revision 1.4 diff -p -u -r1.4 utimens.c --- lib/utimens.c 14 May 2005 06:03:58 -0000 1.4 +++ lib/utimens.c 23 Sep 2005 19:14:59 -0000 @@ -25,6 +25,7 @@ #include "utimens.h" #include +#include #if HAVE_UTIME_H # include @@ -61,7 +62,7 @@ futimens (int fd ATTRIBUTE_UNUSED, /* There's currently no interface to set file timestamps with nanosecond resolution, so do the best we can, discarding any fractional part of the timestamp. */ -#if HAVE_WORKING_UTIMES +#if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES struct timeval timeval[2]; struct timeval const *t; if (timespec) @@ -74,7 +75,11 @@ futimens (int fd ATTRIBUTE_UNUSED, } else t = NULL; -# if HAVE_FUTIMES + +# if HAVE_FUTIMESAT + return fd < 0 ? futimesat (AT_FDCWD, file, t) : futimesat (fd, NULL, t); +# else +# if HAVE_FUTIMES if (0 <= fd) { if (futimes (fd, t) == 0) @@ -92,8 +97,9 @@ futimens (int fd ATTRIBUTE_UNUSED, return -1; } } -# endif +# endif return utimes (file, t); +# endif #else Index: m4/utimens.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/utimens.m4,v retrieving revision 1.4 diff -p -u -r1.4 utimens.m4 --- m4/utimens.m4 21 Mar 2005 22:06:27 -0000 1.4 +++ m4/utimens.m4 23 Sep 2005 19:14:59 -0000 @@ -13,5 +13,5 @@ AC_DEFUN([gl_UTIMENS], AC_REQUIRE([gl_FUNC_UTIMES]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF]) - AC_CHECK_FUNCS_ONCE(futimes) + AC_CHECK_FUNCS_ONCE([futimes futimesat]) ]) From MAILER-DAEMON Fri Sep 23 16:18:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIu0D-0005hk-TI for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:18:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIqd8-0004rQ-PO for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:42:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIqd7-0004qh-5L for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:42:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIqd6-0004pm-W4 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:42:33 -0400 Received: from [193.252.22.23] (helo=smtp8.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIqcl-0002xq-Le for bug-coreutils@gnu.org; Fri, 23 Sep 2005 12:42:11 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0812.wanadoo.fr (SMTP Server) with ESMTP id A50241C001A1 for ; Fri, 23 Sep 2005 18:42:09 +0200 (CEST) Received: from [10.193.86.13] (AStrasbourg-156-1-12-181.w81-51.abo.wanadoo.fr [81.51.35.181]) by mwinf0812.wanadoo.fr (SMTP Server) with ESMTP id 59D0A1C00208 for ; Fri, 23 Sep 2005 18:42:09 +0200 (CEST) X-ME-UUID: 20050923164209368.59D0A1C00208@mwinf0812.wanadoo.fr From: titeuf To: bug-coreutils@gnu.org Content-Type: text/plain; charset=ISO-8859-15 Date: Fri, 23 Sep 2005 18:44:14 +0200 Message-Id: <1127493854.13326.9.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4-3.1.102mdk Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Fri, 23 Sep 2005 16:18:36 -0400 Subject: cutkiller-0.1.tar.bz2 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 16:42:35 -0000 Bonjour Sa fait un bout de temps que je cherche un logiciel cutkiller pour Linux et le voici Merci pour tous. Mais je rencontre un probl=E8me etant pas un expert en Linux j'ai install= =E9 comme indiqu=E9 sur votre tutos qui est tr=E9s bien ex)pliqu=E9. Install as root ( for all users ) : su cp cutekiller /usr/local/bin/cutekiller Puis je suis all=E9 dans le dossier ou je veux recomposer mes fichiers et j'ai ouvert un terminal et j'ai tapez ceci et voici =E9galement la r=E9po= nse d'erreur [titeuf@localhost MyDownloads]$ cutekiller Les.photos.park.001 seq: arguement en virgule flottante invalide: =B11B Pour en savoir davantage, faites: =AB seq --help =BB. J'ai 10 fichiers a joindre D'avance merci pour votre r=E9ponse @+ Et bon Week-End From MAILER-DAEMON Fri Sep 23 16:53:46 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIuYE-0006wb-A8 for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIuY6-0006to-Ai for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIuXz-0006s9-Bt for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIuXw-0006jM-84 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:28 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIuId-0002n8-E1 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:37:39 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8NKbc419772 for ; Fri, 23 Sep 2005 13:37:38 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIuIc-00088b-9a for bug-coreutils@gnu.org; Fri, 23 Sep 2005 13:37:38 -0700 To: bug-coreutils@gnu.org Message-Id: From: Paul Eggert Date: Fri, 23 Sep 2005 13:37:38 -0700 Subject: utime.h cleanup for coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 20:53:40 -0000 I installed the following minor cleanup: system.h and jm-macros.m4 were defining symbols that are no longer used, since the utime stuff now all goes through a gnulib module. 2005-09-23 Paul Eggert * src/system.h: Don't include utime.h; not needed. (struct utimbuf) [!defined HAVE_STRUCT_UTIMBUF]: Remove; not needed. * m4/jm-macros.m4 (gl_MACROS): Don't require gl_CHECK_TYPE_STRUCT_UTIMBUF. (gl_CHECK_ALL_HEADERS): Don't check for utime.h. Index: m4/jm-macros.m4 =================================================================== RCS file: /fetish/cu/m4/jm-macros.m4,v retrieving revision 1.230 diff -p -u -r1.230 jm-macros.m4 --- m4/jm-macros.m4 23 Sep 2005 19:59:07 -0000 1.230 +++ m4/jm-macros.m4 23 Sep 2005 20:34:37 -0000 @@ -1,4 +1,4 @@ -#serial 93 -*- autoconf -*- +#serial 94 -*- autoconf -*- dnl Misc type-related macros for coreutils. @@ -42,7 +42,6 @@ AC_DEFUN([gl_MACROS], AC_REQUIRE([gl_HOST_OS]) AC_REQUIRE([gl_ASSERT]) - AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) AC_REQUIRE([gl_CHECK_DECLS]) @@ -197,7 +196,6 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS], sys/wait.h \ syslog.h \ termios.h \ - utime.h \ ) AC_CHECK_HEADERS(sys/mount.h sys/sysctl.h, [], [], [AC_INCLUDES_DEFAULT Index: src/system.h =================================================================== RCS file: /fetish/cu/src/system.h,v retrieving revision 1.135 diff -p -u -r1.135 system.h --- src/system.h 22 Sep 2005 06:33:40 -0000 1.135 +++ src/system.h 23 Sep 2005 20:34:39 -0000 @@ -92,20 +92,6 @@ you must include before in # define makedev(maj, min) mkdev (maj, min) #endif -#if HAVE_UTIME_H -# include -#endif - -/* Some systems (even some that do have ) don't declare this - structure anywhere. */ -#ifndef HAVE_STRUCT_UTIMBUF -struct utimbuf -{ - long actime; - long modtime; -}; -#endif - /* Don't use bcopy! Use memmove if source and destination may overlap, memcpy otherwise. */ From MAILER-DAEMON Fri Sep 23 16:53:56 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIuYM-00071C-FX for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIuYH-0006xn-I6 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIuY9-0006v6-8S for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIuY7-0006jM-JM for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:39 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIuY7-0003M7-1q for bug-coreutils@gnu.org; Fri, 23 Sep 2005 16:53:39 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8NKrb420949 for ; Fri, 23 Sep 2005 13:53:37 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIuY5-0008AH-NB for bug-coreutils@gnu.org; Fri, 23 Sep 2005 13:53:37 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Fri, 23 Sep 2005 13:53:37 -0700 Message-ID: <87mzm34ib2.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: utimes-related improvements for cp, mv, install X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 20:53:53 -0000 I noticed that cp, mv, and install were using utimes rather than futimes. It's more efficient to operate through the file descriptor if possible, and it also avoids some race conditions. Also, install was invoking utimes twice on the resulting file; that isn't needed unless the -s option is also specified. I installed this: 2005-09-23 Paul Eggert * src/copy.c (copy_reg): Preserve time stamps if x->preserve_timestamps is set, using futimens so that we needn't resolve the path again. (copy_internal): Don't preserve time stamps if copy_reg did it already. * src/install.c (change_timestamps): First arg is source struct stat, not file name. All uses changed. (install_file_in_file): Stat the source file. Don't try to change time stamps if copy_file did it. --- src/copy.c 16 Sep 2005 07:50:33 -0000 1.188 +++ src/copy.c 23 Sep 2005 20:37:59 -0000 @@ -403,6 +403,20 @@ copy_reg (char const *src_name, char con } } + if (x->preserve_timestamps) + { + struct timespec timespec[2]; + timespec[0] = get_stat_atime (src_sb); + timespec[1] = get_stat_mtime (src_sb); + + if (futimens (dest_desc, dst_name, timespec) != 0) + { + error (0, errno, _("preserving times for %s"), quote (dst_name)); + if (x->require_preserve) + return_val = false; + } + } + close_src_and_dst_desc: if (close (dest_desc) < 0) { @@ -1564,10 +1578,9 @@ copy_internal (char const *src_name, cha chown turns off set[ug]id bits for non-root, so do the chmod last. */ - if (x->preserve_timestamps) + if (!copied_as_regular && x->preserve_timestamps) { struct timespec timespec[2]; - timespec[0] = get_stat_atime (&src_sb); timespec[1] = get_stat_mtime (&src_sb); --- src/install.c 16 Sep 2005 07:50:33 -0000 1.187 +++ src/install.c 23 Sep 2005 20:50:49 -0000 1.189 @@ -65,7 +65,7 @@ /* Number of bytes of a file to copy at a time. */ #define READ_SIZE (32 * 1024) -static bool change_timestamps (const char *from, const char *to); +static bool change_timestamps (struct stat const *from_sb, char const *to); static bool change_attributes (char const *name); static bool copy_file (const char *from, const char *to, const struct cp_options *x); @@ -439,14 +439,20 @@ static bool install_file_in_file (const char *from, const char *to, const struct cp_options *x) { + struct stat from_sb; + if (x->preserve_timestamps && stat (from, &from_sb) != 0) + { + error (0, errno, _("cannot stat %s"), quote (from)); + return false; + } if (! copy_file (from, to, x)) return false; if (strip_files) strip (to); if (! change_attributes (to)) return false; - if (x->preserve_timestamps) - return change_timestamps (from, to); + if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))) + return change_timestamps (&from_sb, to); return true; } @@ -526,19 +532,12 @@ change_attributes (char const *name) Return true if successful. */ static bool -change_timestamps (const char *from, const char *to) +change_timestamps (struct stat const *from_sb, char const *to) { - struct stat stb; struct timespec timespec[2]; + timespec[0] = get_stat_atime (from_sb); + timespec[1] = get_stat_mtime (from_sb); - if (stat (from, &stb)) - { - error (0, errno, _("cannot obtain time stamps for %s"), quote (from)); - return false; - } - - timespec[0] = get_stat_atime (&stb); - timespec[1] = get_stat_mtime (&stb); if (utimens (to, timespec)) { error (0, errno, _("cannot set time stamps for %s"), quote (to)); From MAILER-DAEMON Fri Sep 23 17:59:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIvYF-00019S-4b for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 17:57:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIvXt-0000yY-Mm for bug-coreutils@gnu.org; Fri, 23 Sep 2005 17:57:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIvXn-0000vA-N8 for bug-coreutils@gnu.org; Fri, 23 Sep 2005 17:57:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIvXn-0000rA-Cw for bug-coreutils@gnu.org; Fri, 23 Sep 2005 17:57:23 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EIvMo-0006lt-6R for bug-coreutils@gnu.org; Fri, 23 Sep 2005 17:46:02 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8NLju425899; Fri, 23 Sep 2005 14:45:57 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EIvMi-0003sG-Oq; Fri, 23 Sep 2005 14:45:56 -0700 To: titeuf References: <1127493854.13326.9.camel@localhost> From: Paul Eggert Date: Fri, 23 Sep 2005 14:45:56 -0700 In-Reply-To: <1127493854.13326.9.camel@localhost> (titeuf@horizon2010.org's message of "Fri, 23 Sep 2005 18:44:14 +0200") Message-ID: <874q8b4fvv.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: cutkiller-0.1.tar.bz2 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 21:57:34 -0000 titeuf writes: > [titeuf@localhost MyDownloads]$ cutekiller Les.photos.park.001 > seq: arguement en virgule flottante invalide: =C2=B11B > Pour en savoir davantage, faites: =C2=AB seq --help =C2=BB. This looks like a portability bug in cutekiller, not a bug in coreutils per se. Could you please report it to the maintainers of cutekiller? Thanks. (Pardon the English response, but my French is unfortunately very limited.) From MAILER-DAEMON Fri Sep 23 18:57:14 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EIwTh-0000jc-T9 for mharc-bug-coreutils@gnu.org; Fri, 23 Sep 2005 18:57:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EIwTT-0000i7-RQ for bug-coreutils@gnu.org; Fri, 23 Sep 2005 18:57:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EIwTN-0000fO-4y for bug-coreutils@gnu.org; Fri, 23 Sep 2005 18:56:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EIwTL-0000Lv-6c for bug-coreutils@gnu.org; Fri, 23 Sep 2005 18:56:51 -0400 Received: from [82.232.2.251] (helo=farad.aurel32.net) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EIw8s-0001KL-7i for bug-coreutils@gnu.org; Fri, 23 Sep 2005 18:35:42 -0400 Received: from bode.aurel32.net ([2001:618:400:fc13:211:9ff:feed:c498]) by farad.aurel32.net with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1EIw8i-00044t-VR for bug-coreutils@gnu.org; Sat, 24 Sep 2005 00:35:33 +0200 Received: from aurel32 by bode.aurel32.net with local (Exim 4.52) id 1EIw8h-0008Ab-NO for bug-coreutils@gnu.org; Sat, 24 Sep 2005 00:35:31 +0200 Date: Sat, 24 Sep 2005 00:35:31 +0200 From: Aurelien Jarno To: bug-coreutils@gnu.org Message-ID: <20050923223531.GB31385@bode.aurel32.net> References: <20050921214155.GA24657@hertz.aurel32.net> <87k6h9n3d2.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <87k6h9n3d2.fsf@penguin.cs.ucla.edu> X-Mailer: Mutt 1.5.10i (2005-08-11) User-Agent: Mutt/1.5.10i Sender: Aurelien Jarno Subject: Re: [PATCH] cp --no-derefence --link assumes a Linux kernel X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2005 22:57:03 -0000 On Wed, Sep 21, 2005 at 09:16:57PM -0700, Paul Eggert wrote: > Aurelien Jarno writes: > > > POSIX.1-2001 says that link() should dereference symlinks. The Linux > > kernel does not follow POSIX, so that calling cp with --no-dereference > > and --link works as expected. However on non-Linux kernel, this does not > > work as expected, the symlinks being dereferenced. This is even worse > > with symlinks pointing to non-existing paths, where contrary to Linux, > > cp fails in such cases. > > Sorry, I can't quite understand your explanation. Can you please give > a series of shell commands that illustrates the problems? Sure. On GNU/Linux: [bode:/tmp]$ touch a [bode:/tmp]$ ln -s a b [bode:/tmp]$ cp --link --no-dereference b c [bode:/tmp]$ ls -al a b c -rw-r--r-- 1 aurel32 aurel32 0 2005-09-24 00:23 a lrwxrwxrwx 2 aurel32 aurel32 1 2005-09-24 00:23 b -> a lrwxrwxrwx 2 aurel32 aurel32 1 2005-09-24 00:23 c -> a [bode:/tmp]$ On GNU/kFreeBSD (and probably on some other systems): [bode:/tmp]$ touch a [bode:/tmp]$ ln -s a b [bode:/tmp]$ cp --link --no-dereference b c [bode:/tmp]$ ls -al a b c -rw-r--r-- 1 aurel32 aurel32 0 2005-09-24 00:23 a lrwxrwxrwx 2 aurel32 aurel32 1 2005-09-24 00:23 b -> a -rw-r--r-- 1 aurel32 aurel32 0 2005-09-24 00:23 c [bode:/tmp]$ ie the --no-dereference option has been ignored. This is because the POSIX link() function always dereference symlinks, contrary to the Linux kernel. I think in that case a simple copy of the symlink is more appropriate and conducts to the same result. That's what the patch does. > Also, what does "cp --version" and "uname -a" say for you? [bode:/tmp]$ cp --version cp (coreutils) 5.2.1 [bode:/tmp]$ uname -a GNU/kFreeBSD hertz.aurel32.net 5.4-1-686 #0 Wed Sep 7 10:13:03 CEST 2005 i686 GNU/kFreeBSD [bode:/tmp]$ (ie a FreeBSD kernel on a GNU userland, including glibc) Bye, Aurelien -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net From MAILER-DAEMON Sat Sep 24 03:30:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJ4UZ-0001kj-AC for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 03:30:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJ4UX-0001jA-A6 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 03:30:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJ4NI-0008B7-VN for bug-coreutils@gnu.org; Sat, 24 Sep 2005 03:23:34 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJ4NC-0007yH-Dx for bug-coreutils@gnu.org; Sat, 24 Sep 2005 03:23:02 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJ48q-0003j5-83 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 03:08:12 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8O78B423774 for ; Sat, 24 Sep 2005 00:08:11 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJ48p-000834-9e for bug-coreutils@gnu.org; Sat, 24 Sep 2005 00:08:11 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Sat, 24 Sep 2005 00:08:11 -0700 Message-ID: <87r7bflz8k.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: removed uninit-64 test X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2005 07:30:37 -0000 CVS coreutils "make check" failed on 64-bit Solaris 8, because its localtime function returns garbage in tm_year when time_t has an outlandishly large year. It is a bug, but it's not a coreutils bug. Also, the test wouldn't work on a bug-free host with a 64-bit int. Maybe there's a way to resurrect the test so that it doesn't have these false reports, but I couldn't think of it. 2005-09-24 Paul Eggert * tests/misc/date (uninit-64): Remove this test. It wasn't portable in theory (it doesn't work on hosts where 'int' is 64 bits, example) or in practice (Solaris 8 localtime returns garbage in tm_year for the specified date, but that's not coreutils's fault). --- date 16 Sep 2005 18:07:46 -0000 1.19 +++ date 24 Sep 2005 07:05:27 -0000 1.20 @@ -223,23 +223,6 @@ my @Tests = ['neg-secs', '-d @-22 +%05s', {OUT=>"-0022"}], ['neg-secs2', '-d @-22 +%_5s', {OUT=>" -22"}], - # Before today's fix, date would print uninitialized data - # to standard output for an out-of-range date: - # $ date -d @$(echo 2^56-1|bc) 2> /dev/null | od -a -N3 - # 0000000 p 4 6 - # 0000003 - ['uninit-64', '-d @72057594037927935', - {OUT=>''}, - # Use ERR_SUBST to get around fact that the diagnostic - # you get on a system with 32-bit time_t is not the same as - # the one you get for a system where it's 64 bits wide: - # - date: time 72057594037927935 is out of range - # + date: invalid date `@72057594037927935' - {ERR_SUBST => 's/.*//'}, - {ERR => "\n"}, - {EXIT => 1}, - ], - ['fill-1', '-d 1999-12-08 +%_3d', {OUT=>' 8'}], ['fill-2', '-d 1999-12-08 +%03d', {OUT=>'008'}], From MAILER-DAEMON Sat Sep 24 04:29:21 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJ5PC-0006Av-9F for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 04:29:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJ5Oz-00069h-QQ for bug-coreutils@gnu.org; Sat, 24 Sep 2005 04:28:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJ5Nm-000623-BR for bug-coreutils@gnu.org; Sat, 24 Sep 2005 04:27:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJ5Lh-0005WE-68 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 04:25:33 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJ52K-0007Xh-8y for bug-coreutils@gnu.org; Sat, 24 Sep 2005 04:05:32 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 3D691C53; Sat, 24 Sep 2005 10:05:31 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87r7bflz8k.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Sat, 24 Sep 2005 00:08:11 -0700") References: <87r7bflz8k.fsf@penguin.cs.ucla.edu> Date: Sat, 24 Sep 2005 10:05:31 +0200 Message-ID: <87fyru51ro.fsf@rho.meyering.net> Lines: 84 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: removed uninit-64 test X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2005 08:29:01 -0000 Paul Eggert wrote: > CVS coreutils "make check" failed on 64-bit Solaris 8, because its > localtime function returns garbage in tm_year when time_t has an > outlandishly large year. It is a bug, but it's not a coreutils bug. > Also, the test wouldn't work on a bug-free host with a 64-bit int. > Maybe there's a way to resurrect the test so that it doesn't have > these false reports, but I couldn't think of it. > > 2005-09-24 Paul Eggert > > * tests/misc/date (uninit-64): Remove this test. It wasn't > portable in theory (it doesn't work on hosts where 'int' is 64 > bits, example) or in practice (Solaris 8 localtime returns garbage > in tm_year for the specified date, but that's not coreutils's > fault). Thanks for looking into that. It was also a problem on an alphaev56-dec-osf4.0f system. However, I didn't like the idea of dropping the test everywhere just because it gets spurious failures due to a couple of buggy localtime implementations, so I did this: 2005-09-24 Jim Meyering * tests/misc/date (uninit-64): Restore this test. Add start-up code to detect, and work around, the cases in which the test might fail. Can you confirm that it works on your Solaris 8 system? Index: date =================================================================== RCS file: /fetish/cu/tests/misc/date,v retrieving revision 1.20 retrieving revision 1.21 diff -u -p -u -r1.20 -r1.21 --- date 24 Sep 2005 07:05:27 -0000 1.20 +++ date 24 Sep 2005 07:57:36 -0000 1.21 @@ -36,6 +36,20 @@ my $dy = '1998-01-19'; # next month my $fmt = "'+%Y-%m-%d %T'"; +# Determine a number of seconds that will provoke an invalid +# time diagnostic from date. If possible, use a number that +# is less than 2^64, yet so large that it would cause the resulting +# tm_year value to be too large for a 32-bit int. But some systems +# (Solaris 8) have a buggy localtime that mistakenly accepts such +# invalid times and give garbage in tm_year. Other systems might +# have an int type that is wider than 32. So if this localtime +# call succeeds, use 2^64 as the number of seconds. +my $n_seconds = 72057594037927935; +my @d = localtime ($n_seconds); +my $year = $d[5]; +defined $year + and $n_seconds = '18446744073709551616'; + my @Tests = ( # test-name, [option, option, ...] {OUT=>"expected-output"} @@ -223,6 +237,23 @@ my @Tests = ['neg-secs', '-d @-22 +%05s', {OUT=>"-0022"}], ['neg-secs2', '-d @-22 +%_5s', {OUT=>" -22"}], + # Before today's fix, date would print uninitialized data + # to standard output for an out-of-range date: + # $ date -d @$(echo 2^56-1|bc) 2> /dev/null | od -a -N3 + # 0000000 p 4 6 + # 0000003 + ['uninit-64', "-d \@$n_seconds", + {OUT=>''}, + # Use ERR_SUBST to get around fact that the diagnostic + # you get on a system with 32-bit time_t is not the same as + # the one you get for a system where it's 64 bits wide: + # - date: time 72057594037927935 is out of range + # + date: invalid date `@72057594037927935' + {ERR_SUBST => 's/.*//'}, + {ERR => "\n"}, + {EXIT => 1}, + ], + ['fill-1', '-d 1999-12-08 +%_3d', {OUT=>' 8'}], ['fill-2', '-d 1999-12-08 +%03d', {OUT=>'008'}], From MAILER-DAEMON Sat Sep 24 08:24:41 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJ956-0000sW-8x for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 08:24:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJ94z-0000q5-Kp for bug-coreutils@gnu.org; Sat, 24 Sep 2005 08:24:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJ94x-0000op-4C for bug-coreutils@gnu.org; Sat, 24 Sep 2005 08:24:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJ94s-0000d6-Nz; Sat, 24 Sep 2005 08:24:27 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJ8yK-0005Mg-C6; Sat, 24 Sep 2005 08:17:40 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id C8256C53; Sat, 24 Sep 2005 14:17:11 +0200 (CEST) From: Jim Meyering To: bug-gnulib@gnu.org, bug-coreutils@gnu.org Date: Sat, 24 Sep 2005 14:17:11 +0200 Message-ID: <87oe6i3bjs.fsf@rho.meyering.net> Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: gethostbyname on Solaris 5.7 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2005 12:24:36 -0000 Here's a log of a failed Solaris 5.7 build cc -I/usr/local/include -R/usr/local/lib -L/usr/local/lib -o pinky pinky.o ../lib/libcoreutils.a /usr/local/lib/libintl.so /usr/local/lib/libiconv.so -lc -R/usr/local/lib ../lib/libcoreutils.a Undefined first referenced symbol in file gethostbyname ../lib/libcoreutils.a(getaddrinfo.o) getservbyname ../lib/libcoreutils.a(getaddrinfo.o) ld: fatal: Symbol referencing errors. No output written to pinky make[3]: *** [pinky] Error 1 The problem was that coreutils no longer had the check for -lnsl. coreutils-5.3.0 had that test in canon-host.m4, and now that canon-host is just a wrapper around getaddrinfo, it's appropriate that it no longer perform this check. So getaddrinfo.m4 must do it, now, and I've made the following change in coreutils, and will commit it to gnulib as soon as I've confirmed it works. 2005-09-24 Jim Meyering * getaddrinfo.m4 (gl_GETADDRINFO): Check for gethostbyname in the inet and nsl libraries. Required on Solaris 5.7. Index: m4/getaddrinfo.m4 =================================================================== RCS file: /fetish/cu/m4/getaddrinfo.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -u -r1.4 -r1.5 --- m4/getaddrinfo.m4 23 Sep 2005 19:40:04 -0000 1.4 +++ m4/getaddrinfo.m4 24 Sep 2005 10:44:30 -0000 1.5 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 4 +# getaddrinfo.m4 serial 5 dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,7 @@ dnl with or without modifications, as lo AC_DEFUN([gl_GETADDRINFO], [ AC_SEARCH_LIBS(getaddrinfo, nsl socket) + AC_SEARCH_LIBS(gethostbyname, [inet nsl]) AC_REPLACE_FUNCS(getaddrinfo gai_strerror) gl_PREREQ_GETADDRINFO ]) From MAILER-DAEMON Sat Sep 24 19:25:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJJOr-0004TQ-9F for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:25:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJJOl-0004OM-DJ for bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:25:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJJOh-0004JW-6P for bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:25:36 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJJOd-0003z8-Kt; Sat, 24 Sep 2005 19:25:32 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJJLU-0001Ri-D7; Sat, 24 Sep 2005 19:22:16 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8ONMF426983; Sat, 24 Sep 2005 16:22:15 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJJLT-0002Aw-BB; Sat, 24 Sep 2005 16:22:15 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Sat, 24 Sep 2005 16:22:15 -0700 Message-ID: <8764sqkq54.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-gnulib@gnu.org Subject: problem with mbchar module on OpenBSD X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2005 23:25:41 -0000 With coreutils CVS on OpenBSD 3.4, I ran into the same problem with the mbchar module that Yoann Vandoorselaere first reported with OpenBSD 3.7 in . I installed the following patch into coreutils, which is about the same as Derek Price's proposed gnulib patch . 2005-09-24 Paul Eggert * lib/Makefile.am (libcoreutils_a_SOURCES): Remove mbchar.c, since it doesn't build in OpenBSD 3.4. See . * m4/mbchar.m4 (gl_MBCHAR): Check for wchar.h and wctype.h, and don't compile mbchar.c unless both headers exist. See . --- lib/Makefile.am 22 Sep 2005 06:58:56 -0000 1.233 +++ lib/Makefile.am 24 Sep 2005 23:06:14 -0000 @@ -35,7 +35,7 @@ libcoreutils_a_SOURCES = \ getaddrinfo.h \ gettext.h \ localcharset.c localcharset.h \ - mbchar.c mbchar.h \ + mbchar.h \ mbswidth.c mbswidth.h \ mbuiter.h \ readtokens0.c readtokens0.h \ --- m4/mbchar.m4 22 Sep 2005 06:22:44 -0000 1.1 +++ m4/mbchar.m4 24 Sep 2005 23:06:14 -0000 @@ -1,4 +1,4 @@ -# mbchar.m4 serial 1 +# mbchar.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,6 +9,13 @@ dnl From Bruno Haible. AC_DEFUN([gl_MBCHAR], [ + AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) + + case $ac_cv_header_wchar_h,$ac_cv_header_wctype_h in + yes,yes) + AC_LIBOBJ([mbchar]);; + esac + AC_REQUIRE([AC_GNU_SOURCE]) : ]) From MAILER-DAEMON Sat Sep 24 19:26:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJJPs-00054X-O0 for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:26:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJJPo-00052i-KI for bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:26:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJJPm-00051b-Le for bug-coreutils@gnu.org; Sat, 24 Sep 2005 19:26:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJJPM-0003z8-35; Sat, 24 Sep 2005 19:26:16 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJJ4r-00011i-SR; Sat, 24 Sep 2005 19:05:06 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8ON54426459; Sat, 24 Sep 2005 16:05:04 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJJ4q-00029o-BC; Sat, 24 Sep 2005 16:05:04 -0700 To: bug-gnulib@gnu.org, bug-coreutils@gnu.org From: Paul Eggert Date: Sat, 24 Sep 2005 16:05:04 -0700 Message-ID: <87aci2kqxr.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: regex workaround for gcc 2.95.3 core dump X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2005 23:26:47 -0000 I installed the following to work around a build failure of coreutils CVS on OpenBSD 3.4. (For now I have resisted the temptation to enable __attribute__ only for GCC 4.0 and later. :-) 2005-09-24 Paul Eggert * regex_internal.h (__attribute): Define to nothing for GCC 2. This works around a core dump on OpenBSD 3.4, which has GCC 2.95.3, which dumps core when given __attribute__(()). --- lib/regex_internal.h 23 Sep 2005 04:15:13 -0000 1.17 +++ lib/regex_internal.h 24 Sep 2005 23:01:17 -0000 1.18 @@ -131,7 +131,7 @@ # define attribute_hidden #endif /* not _LIBC */ -#ifdef __GNUC__ +#if __GNUC__ >= 3 # define __attribute(arg) __attribute__ (arg) #else # define __attribute(arg) From MAILER-DAEMON Sat Sep 24 23:31:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJNEI-0005UB-Qj for mharc-bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:31:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJNED-0005SI-M3 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:31:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJNEC-0005R8-0V for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:31:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJNBc-00047d-BO for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:28:20 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJMvu-0005dQ-B6 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:12:06 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8P3C5405058 for ; Sat, 24 Sep 2005 20:12:05 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJMvs-0002D3-Sy for bug-coreutils@gnu.org; Sat, 24 Sep 2005 20:12:04 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Sat, 24 Sep 2005 20:12:04 -0700 Message-ID: <871x3dlu2j.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: modifying cp, etc. to prefer fchown to chown and fchmod to chmod X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 03:31:05 -0000 I installed this patch so that 'cp -p' prefers to use fchown to chown, and fchmod to chmod, when copying regular files. The f* versions ought to be a bit faster since they needn't resolve file names. I left a FIXME for preserving st_author, as I don't know how to preserve that on the Hurd. Perhaps a Hurd expert can fill that part in. In the mean time the existing code should still work on the Hurd. 2005-09-24 Paul Eggert * m4/jm-macros.m4 (gl_MACROS): Check for fchmod and fchown. * src/copy.c (HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined. (copy_reg): New args CHOWN_SUCCEDED and DST_SB. All callers changed. Add a "goto close_src_and_dst_desc;" that was missing in the previous patch. (copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown. (copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod. (copy_internal): Don't invoke chown if fchown worked, and likewise for chmod and fchmod. Index: m4/jm-macros.m4 =================================================================== RCS file: /fetish/cu/m4/jm-macros.m4,v retrieving revision 1.231 diff -p -u -r1.231 jm-macros.m4 --- m4/jm-macros.m4 23 Sep 2005 20:35:14 -0000 1.231 +++ m4/jm-macros.m4 24 Sep 2005 23:27:41 -0000 @@ -102,6 +102,8 @@ AC_DEFUN([gl_MACROS], AC_CHECK_FUNCS_ONCE( \ endgrent \ endpwent \ + fchmod \ + fchown \ ftruncate \ hasmntopt \ isascii \ Index: src/copy.c =================================================================== RCS file: /fetish/cu/src/copy.c,v retrieving revision 1.189 diff -p -u -r1.189 copy.c --- src/copy.c 23 Sep 2005 20:38:34 -0000 1.189 +++ src/copy.c 24 Sep 2005 23:27:41 -0000 @@ -51,6 +51,13 @@ #include "xreadlink.h" #include "yesno.h" +#ifndef HAVE_FCHMOD +# define HAVE_FCHMOD false +#endif +#ifndef HAVE_FCHOWN +# define HAVE_FCHOWN false +#endif + #define SAME_OWNER(A, B) ((A).st_uid == (B).st_uid) #define SAME_GROUP(A, B) ((A).st_gid == (B).st_gid) #define SAME_OWNER_AND_GROUP(A, B) (SAME_OWNER (A, B) && SAME_GROUP (A, B)) @@ -191,13 +198,16 @@ copy_dir (char const *src_name_in, char Use DST_MODE as the 3rd argument in the call to open. X provides many option settings. Return true if successful. - *NEW_DST is as in copy_internal. SRC_SB is the result - of calling xstat (aka stat in this case) on SRC_NAME. */ + *NEW_DST and *CHOWN_SUCCEEDED are as in copy_internal. + SRC_SB and DST_SB are the results of calling XSTAT (aka stat for + SRC_SB) on SRC_NAME and DST_NAME. */ static bool copy_reg (char const *src_name, char const *dst_name, const struct cp_options *x, mode_t dst_mode, bool *new_dst, - struct stat const *src_sb) + bool *chown_succeeded, + struct stat const *src_sb, + struct stat const *dst_sb) { char *buf; size_t buf_size; @@ -400,6 +410,7 @@ copy_reg (char const *src_name, char con { error (0, errno, _("writing %s"), quote (dst_name)); return_val = false; + goto close_src_and_dst_desc; } } @@ -413,10 +424,57 @@ copy_reg (char const *src_name, char con { error (0, errno, _("preserving times for %s"), quote (dst_name)); if (x->require_preserve) - return_val = false; + { + return_val = false; + goto close_src_and_dst_desc; + } } } +#if HAVE_FCHOWN + if (x->preserve_ownership + && (*new_dst || !SAME_OWNER_AND_GROUP (*src_sb, *dst_sb))) + { + if (fchown (dest_desc, src_sb->st_uid, src_sb->st_gid) == 0) + *chown_succeeded = true; + else if (! chown_failure_ok (x)) + { + error (0, errno, _("failed to preserve ownership for %s"), + quote (dst_name)); + if (x->require_preserve) + { + return_val = false; + goto close_src_and_dst_desc; + } + } + } +#endif + +#if HAVE_STRUCT_STAT_ST_AUTHOR + /* FIXME: Preserve the st_author field via the file descriptor dest_desc. */ +#endif + +#if HAVE_FCHMOD + /* Permissions of newly-created regular files were set upon `open'. + But don't return early if there were any special bits and chown + succeeded, because the chown must have reset those bits. */ + if (!(*new_dst + && !(*chown_succeeded && (src_sb->st_mode & ~S_IRWXUGO))) + && (x->preserve_mode || *new_dst) + && (x->copy_as_regular || S_ISREG (src_sb->st_mode))) + { + if (fchmod (dest_desc, get_dest_mode (x, src_sb->st_mode)) != 0) + { + error (0, errno, _("setting permissions for %s"), quote (dst_name)); + if (x->set_mode || x->require_preserve) + { + return_val = false; + goto close_src_and_dst_desc; + } + } + } +#endif + close_src_and_dst_desc: if (close (dest_desc) < 0) { @@ -1458,15 +1516,15 @@ copy_internal (char const *src_name, cha } } else if (S_ISREG (src_type) - || (x->copy_as_regular && !S_ISDIR (src_type) - && !S_ISLNK (src_type))) + || (x->copy_as_regular && !S_ISLNK (src_type))) { copied_as_regular = true; /* POSIX says the permission bits of the source file must be used as the 3rd argument in the open call, but that's not consistent with historical practice. */ if (! copy_reg (src_name, dst_name, x, - get_dest_mode (x, src_mode), &new_dst, &src_sb)) + get_dest_mode (x, src_mode), &new_dst, &chown_succeeded, + &src_sb, &dst_sb)) goto un_backup; } else @@ -1593,7 +1651,7 @@ copy_internal (char const *src_name, cha } /* Avoid calling chown if we know it's not necessary. */ - if (x->preserve_ownership + if (!(copied_as_regular && HAVE_FCHOWN) && x->preserve_ownership && (new_dst || !SAME_OWNER_AND_GROUP (src_sb, dst_sb))) { if (chown (dst_name, src_sb.st_uid, src_sb.st_gid) == 0) @@ -1624,11 +1682,12 @@ copy_internal (char const *src_name, cha } #endif - /* Permissions of newly-created regular files were set upon `open' in - copy_reg. But don't return early if there were any special bits and + /* Permissions of newly-created regular files are set by open and/or fchmod + in copy_reg. But don't return early if there were any special bits and chown succeeded, because the chown must have reset those bits. */ - if ((new_dst && copied_as_regular) - && !(chown_succeeded && (src_mode & ~S_IRWXUGO))) + if (copied_as_regular + && (HAVE_FCHMOD + || (new_dst && !(chown_succeeded && (src_mode & ~S_IRWXUGO))))) return delayed_ok; if ((x->preserve_mode || new_dst) From MAILER-DAEMON Sun Sep 25 00:25:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJO5N-00012N-Rx for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 00:25:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJO5E-0000xu-Oq for bug-coreutils@gnu.org; Sun, 25 Sep 2005 00:25:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJO58-0000sh-Mb for bug-coreutils@gnu.org; Sun, 25 Sep 2005 00:25:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJO53-0000ml-S9; Sun, 25 Sep 2005 00:25:37 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJO25-0000Um-Qq; Sun, 25 Sep 2005 00:22:34 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8P4Li407525; Sat, 24 Sep 2005 21:21:45 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJO1I-0002Z0-1A; Sat, 24 Sep 2005 21:21:44 -0700 To: Derek Price References: <87aci2kqxr.fsf@penguin.cs.ucla.edu> <43361910.9090002@ximbiot.com> From: Paul Eggert Date: Sat, 24 Sep 2005 21:21:44 -0700 In-Reply-To: <43361910.9090002@ximbiot.com> (Derek Price's message of "Sat, 24 Sep 2005 23:27:12 -0400") Message-ID: <87wtl5kc9z.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org Subject: Re: regex workaround for gcc 2.95.3 core dump X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 04:25:52 -0000 Derek Price writes: > . Thanks for mentioning that. Can you believe that I had forgotten all about our earlier fix? Anyway, I installed that patch in both coreutils and gnulib, with this changelog entry: 2005-09-24 Paul Eggert * regex_internal.h (__GNUC_PREREQ, always_inline, inline, pure): Remove. (__attribute): Define to empty unless GCC 3.1 or later. This works around a core dump on OpenBSD 3.4, which has GCC 2.95.3, which dumps core when given __attribute__(()). It also simplifies other tests, since we really don't want to bother with worrying about which ancient version of GCC supported what. Original problem reported by Yoann Vandoorselaere, with part of the fix suggested by Derek Price. From MAILER-DAEMON Sun Sep 25 02:26:13 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJPx5-0002kX-St for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 02:25:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJPwV-0002fD-P0 for bug-coreutils@gnu.org; Sun, 25 Sep 2005 02:24:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJPwR-0002e6-UM for bug-coreutils@gnu.org; Sun, 25 Sep 2005 02:24:53 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJPwN-0002Ye-KN for bug-coreutils@gnu.org; Sun, 25 Sep 2005 02:24:49 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJPt6-0006l5-Mv for bug-coreutils@gnu.org; Sun, 25 Sep 2005 02:21:24 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8P6LN411732 for ; Sat, 24 Sep 2005 23:21:23 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJPt5-00071W-Ew for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:21:23 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Sat, 24 Sep 2005 23:21:23 -0700 Message-ID: <87slvtk6qk.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 06:25:00 -0000 The recent changes involving adding better support for futimes, fchmod, and fchown got me to thinking that these system calls aren't easily accessible to shell scripts, which goes counter to a primary original motivation for the shell -- namely, that it was a thin shell around the operating system calls. To help counteract this for futimes, we can have "touch -" touch the standard output, i.e., it can invoke futimes on the standard output rather than utimes on the file named "-". This is pretty straightforward so I installed the following patch. Harder to implement (and more controversial, perhaps) would be that "chmod a-w -" and "chown root:sys -" should affect standard output rather than a file named "-". I'll omit this change for now. (The mind reels at "chmod -r a-w - 1 * NEWS: "touch -" now touches standard output. * doc/coreutils.texi (touch invocation): Document this. * lib/utimens.c (ENOSYS): Define if not already defined. (futimens): Support having a null PATH if the file descriptor is nonnegative. * src/touch.c (touch): Implement this. (usage): Document this. Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.312 diff -p -u -r1.312 NEWS --- NEWS 16 Sep 2005 08:19:04 -0000 1.312 +++ NEWS 25 Sep 2005 06:03:24 -0000 @@ -216,6 +216,8 @@ GNU coreutils NEWS stat -f's default output format has been changed to output this size as well. stat -f recognizes file systems of type XFS and JFS + "touch -" now touches standard output, not a file named "-". + uname -a no longer generates the -p and -i outputs if they are unknown. * Major changes in release 5.3.0 (2005-01-08) [unstable] Index: doc/coreutils.texi =================================================================== RCS file: /fetish/cu/doc/coreutils.texi,v retrieving revision 1.284 diff -p -u -r1.284 coreutils.texi --- doc/coreutils.texi 17 Sep 2005 07:44:42 -0000 1.284 +++ doc/coreutils.texi 25 Sep 2005 06:01:48 -0000 @@ -8541,6 +8541,9 @@ touch [@var{option}]@dots{} @var{file}@d @cindex empty files, creating Any @var{file} that does not exist is created empty. +A @var{file} of @samp{-} causes @command{touch} to change the +times of the file associated with standard output. + @cindex permissions, for changing file timestamps If changing both the access and modification times to the current time, @command{touch} can change the timestamps for files that the user Index: lib/utimens.c =================================================================== RCS file: /fetish/cu/lib/utimens.c,v retrieving revision 1.8 diff -p -u -r1.8 utimens.c --- lib/utimens.c 23 Sep 2005 19:18:27 -0000 1.8 +++ lib/utimens.c 25 Sep 2005 06:01:48 -0000 @@ -41,6 +41,16 @@ struct utimbuf }; #endif +/* Some systems don't have ENOSYS. */ +#ifndef ENOSYS +# ifdef ENOTSUP +# define ENOSYS ENOTSUP +# else +/* Some systems don't have ENOTSUP either. */ +# define ENOSYS EINVAL +# endif +#endif + #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) #endif @@ -53,7 +63,11 @@ struct utimbuf TIMESPEC[0] and TIMESPEC[1], respectively. FD must be either negative -- in which case it is ignored -- or a file descriptor that is open on FILE. - If TIMESPEC is null, set the time stamps to the current time. */ + If FD is nonnegative, then FILE can be NULL, which means + use just futimes (or equivalent) instead of utimes (or equivalent), + and fail if on an old system without futimes (or equivalent). + If TIMESPEC is null, set the time stamps to the current time. + Return 0 on success, -1 (setting errno) on failure. */ int futimens (int fd ATTRIBUTE_UNUSED, @@ -78,8 +92,7 @@ futimens (int fd ATTRIBUTE_UNUSED, # if HAVE_FUTIMESAT return fd < 0 ? futimesat (AT_FDCWD, file, t) : futimesat (fd, NULL, t); -# else -# if HAVE_FUTIMES +# elif HAVE_FUTIMES if (0 <= fd) { if (futimes (fd, t) == 0) @@ -97,23 +110,35 @@ futimens (int fd ATTRIBUTE_UNUSED, return -1; } } -# endif - return utimes (file, t); # endif +#endif -#else +#if ! HAVE_FUTIMES_AT - struct utimbuf utimbuf; - struct utimbuf const *t; - if (timespec) + if (!file) { - utimbuf.actime = timespec[0].tv_sec; - utimbuf.modtime = timespec[1].tv_sec; - t = &utimbuf; + errno = ENOSYS; + return -1; } - else - t = NULL; - return utime (file, t); + +# if HAVE_WORKING_UTIMES + return utimes (file, t); +# else + { + struct utimbuf utimbuf; + struct utimbuf const *ut; + if (timespec) + { + utimbuf.actime = timespec[0].tv_sec; + utimbuf.modtime = timespec[1].tv_sec; + ut = &utimbuf; + } + else + ut = NULL; + + return utime (file, ut); + } +# endif #endif } Index: src/touch.c =================================================================== RCS file: /fetish/cu/src/touch.c,v retrieving revision 1.134 diff -p -u -r1.134 touch.c --- src/touch.c 16 Sep 2005 07:50:33 -0000 1.134 +++ src/touch.c 25 Sep 2005 06:01:48 -0000 @@ -125,7 +125,9 @@ touch (const char *file) struct timespec timespec[2]; struct timespec const *t; - if (! no_create) + if (STREQ (file, "-")) + fd = STDOUT_FILENO; + else if (! no_create) { /* Try to open FILE, creating it if necessary. */ fd = fd_reopen (STDIN_FILENO, file, @@ -157,7 +159,7 @@ touch (const char *file) error (0, errno, _("failed to get attributes of %s"), quote (file)); } - if (fd != -1) + if (fd == STDIN_FILENO) close (fd); return false; } @@ -181,7 +183,7 @@ touch (const char *file) } ok = (futimens (fd, file, t) == 0); - if (fd != -1) + if (fd == STDIN_FILENO) ok &= (close (fd) == 0); if (!ok) @@ -241,6 +243,8 @@ Mandatory arguments to long options are fputs (_("\ \n\ Note that the -d and -t options accept different time-date formats.\n\ +\n\ +If a FILE is -, touch standard output.\n\ "), stdout); printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); } From MAILER-DAEMON Sun Sep 25 04:19:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJRjS-0004OM-QZ for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 04:19:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJNHc-00071P-09 for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:34:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJNHa-00070b-Ct for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:34:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJNHa-00070Y-9C for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:34:30 -0400 Received: from [69.17.117.30] (helo=mail28.sea5.speakeasy.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJNGp-0006jG-DX for bug-coreutils@gnu.org; Sat, 24 Sep 2005 23:33:43 -0400 Received: (qmail 26608 invoked from network); 25 Sep 2005 03:27:01 -0000 Received: from ns.ximbiot.com (HELO [127.0.0.1]) ([66.92.238.135]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 25 Sep 2005 03:27:01 -0000 Message-ID: <43361910.9090002@ximbiot.com> Date: Sat, 24 Sep 2005 23:27:12 -0400 From: Derek Price Organization: Get CVS Support from Ximbiot ! User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Paul Eggert References: <87aci2kqxr.fsf@penguin.cs.ucla.edu> In-Reply-To: <87aci2kqxr.fsf@penguin.cs.ucla.edu> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sun, 25 Sep 2005 04:19:32 -0400 Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org Subject: Re: regex workaround for gcc 2.95.3 core dump X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 03:34:32 -0000 Paul, This is the same problem I ran into a few days ago on several platforms, and you helped me come up with this patch: . The patch in that message also removes a little cruft and handles a similar problem in a later GCC with always_inline, by ignoring __attribute__ for GCC < 3.1. Regards, Derek Paul Eggert wrote: >I installed the following to work around a build failure of coreutils >CVS on OpenBSD 3.4. (For now I have resisted the temptation to enable >__attribute__ only for GCC 4.0 and later. :-) > >2005-09-24 Paul Eggert > > * regex_internal.h (__attribute): Define to nothing for GCC 2. > This works around a core dump on OpenBSD 3.4, which has GCC > 2.95.3, which dumps core when given __attribute__(()). > >--- lib/regex_internal.h 23 Sep 2005 04:15:13 -0000 1.17 >+++ lib/regex_internal.h 24 Sep 2005 23:01:17 -0000 1.18 >@@ -131,7 +131,7 @@ > # define attribute_hidden > #endif /* not _LIBC */ > >-#ifdef __GNUC__ >+#if __GNUC__ >= 3 > # define __attribute(arg) __attribute__ (arg) > #else > # define __attribute(arg) > > >_______________________________________________ >bug-gnulib mailing list >bug-gnulib@gnu.org >http://lists.gnu.org/mailman/listinfo/bug-gnulib > > -- Derek R. Price CVS Solutions Architect Ximbiot v: +1 717.579.6168 f: +1 717.234.3125 From MAILER-DAEMON Sun Sep 25 06:29:06 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJTkk-0007mA-MC for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 06:29:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJTkg-0007lG-2J for bug-coreutils@gnu.org; Sun, 25 Sep 2005 06:28:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJTkc-0007kY-Vg for bug-coreutils@gnu.org; Sun, 25 Sep 2005 06:28:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJTkK-00074A-KC; Sun, 25 Sep 2005 06:28:37 -0400 Received: from [217.13.230.178] (helo=yxa.extundo.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJTPY-0003Ah-4m; Sun, 25 Sep 2005 06:07:08 -0400 Received: from latte.josefsson.org (c494102a.s-bi.bostream.se [217.215.27.65]) (authenticated bits=0) by yxa.extundo.com (8.13.4/8.13.4/Debian-3) with ESMTP id j8PA73nH000952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 25 Sep 2005 12:07:04 +0200 From: Simon Josefsson To: Jim Meyering References: <87oe6i3bjs.fsf@rho.meyering.net> OpenPGP: id=B565716F; url=http://josefsson.org/key.txt Mail-Copies-To: nobody X-Hashcash: 1:21:050925:bug-coreutils@gnu.org::zyOOw9OiK7Y4UW98:0mUd X-Hashcash: 1:21:050925:bug-gnulib@gnu.org::XKzKhLWYv/BW3v9a:1phR X-Hashcash: 1:21:050925:jim@meyering.net::NRcd/NLhc4t5nBTz:5O5U Date: Sun, 25 Sep 2005 12:07:01 +0200 In-Reply-To: <87oe6i3bjs.fsf@rho.meyering.net> (Jim Meyering's message of "Sat, 24 Sep 2005 14:17:11 +0200") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV version 0.84, clamav-milter version 0.84e on yxa.extundo.com X-Virus-Status: Clean Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org Subject: Re: gethostbyname on Solaris 5.7 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 10:28:59 -0000 Jim Meyering writes: > Here's a log of a failed Solaris 5.7 build > > cc -I/usr/local/include -R/usr/local/lib -L/usr/local/lib -o pinky pinky.o ../lib/libcoreutils.a /usr/local/lib/libintl.so /usr/local/lib/libiconv.so -lc -R/usr/local/lib ../lib/libcoreutils.a > Undefined first referenced > symbol in file > gethostbyname ../lib/libcoreutils.a(getaddrinfo.o) > getservbyname ../lib/libcoreutils.a(getaddrinfo.o) > ld: fatal: Symbol referencing errors. No output written to pinky > make[3]: *** [pinky] Error 1 > > The problem was that coreutils no longer had the check for -lnsl. > coreutils-5.3.0 had that test in canon-host.m4, and now that canon-host > is just a wrapper around getaddrinfo, it's appropriate that it no longer > perform this check. So getaddrinfo.m4 must do it, now, > and I've made the following change in coreutils, and > will commit it to gnulib as soon as I've confirmed it works. Hi! Looks good, thanks! > 2005-09-24 Jim Meyering > > * getaddrinfo.m4 (gl_GETADDRINFO): Check for gethostbyname > in the inet and nsl libraries. Required on Solaris 5.7. > > Index: m4/getaddrinfo.m4 > =================================================================== > RCS file: /fetish/cu/m4/getaddrinfo.m4,v > retrieving revision 1.4 > retrieving revision 1.5 > diff -u -p -u -r1.4 -r1.5 > --- m4/getaddrinfo.m4 23 Sep 2005 19:40:04 -0000 1.4 > +++ m4/getaddrinfo.m4 24 Sep 2005 10:44:30 -0000 1.5 > @@ -1,4 +1,4 @@ > -# getaddrinfo.m4 serial 4 > +# getaddrinfo.m4 serial 5 > dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. > dnl This file is free software; the Free Software Foundation > dnl gives unlimited permission to copy and/or distribute it, > @@ -7,6 +7,7 @@ dnl with or without modifications, as lo > AC_DEFUN([gl_GETADDRINFO], > [ > AC_SEARCH_LIBS(getaddrinfo, nsl socket) > + AC_SEARCH_LIBS(gethostbyname, [inet nsl]) > AC_REPLACE_FUNCS(getaddrinfo gai_strerror) > gl_PREREQ_GETADDRINFO > ]) From MAILER-DAEMON Sun Sep 25 08:59:54 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJW6j-0002zM-Rn for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 08:59:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJW2z-00028W-6X for bug-coreutils@gnu.org; Sun, 25 Sep 2005 08:56:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJW2j-00021J-VF for bug-coreutils@gnu.org; Sun, 25 Sep 2005 08:55:47 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJW2h-0001yK-Lv for bug-coreutils@gnu.org; Sun, 25 Sep 2005 08:55:43 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJVyq-0006sZ-5L for bug-coreutils@gnu.org; Sun, 25 Sep 2005 08:51:44 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 95D5C17F2; Sun, 25 Sep 2005 14:51:42 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Date: Sun, 25 Sep 2005 14:51:42 +0200 Message-ID: <87k6h5z4wx.fsf@rho.meyering.net> Lines: 33 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: coreutils test failure due to OOPS in amd64 linux-2.6.9: tmpfs-related X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 12:59:47 -0000 For the record, there seems to be a bug in amd64 linux-2.6.9 that causes (soon-to-be-released) coreutils-5.3.1's tests/part-symlink to fail with lots of segfaults (and kernel OOPSs) if the working directory name is long enough. I'm not planning to make the test work around it, since 2.6.9 is pretty old for AMD64, and this isn't a problem with newer kernels. The problem is that we get an OPPS when unlinking a symlink in /dev/shm (tmpfs) when that symlink's value is 41 bytes or longer. Here's a pared-down demo: Unlinking a symlink with a 40-byte value works fine: $ ln -s $(printf %040d 0) /dev/shm/x; unlink /dev/shm/x Unlinking a symlink with a 41-byte value causes the OOPS: $ ln -s $(printf %041d 0) /dev/shm/x; unlink /dev/shm/x Killed [Exit 137 (SIGKILL)] $ Message from syslogd@xxxx at Sun Sep 25 05:12:42 2005 ... xxxx kernel: Oops: 0000 [124] SMP Message from syslogd@xxxx at Sun Sep 25 05:12:42 2005 ... xxxx kernel: CR2: 0000000000000090 $ df -hT /dev/shm Filesystem Type Size Used Avail Use% Mounted on none tmpfs 3.7G 0 3.7G 0% /dev/shm $ uname -r 2.6.9-1.667smp From MAILER-DAEMON Sun Sep 25 15:55:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJcb5-0003zh-3j for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 15:55:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJcb2-0003yS-5t for bug-coreutils@gnu.org; Sun, 25 Sep 2005 15:55:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJcb1-0003xt-5c for bug-coreutils@gnu.org; Sun, 25 Sep 2005 15:55:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJcZN-00033E-OX for bug-coreutils@gnu.org; Sun, 25 Sep 2005 15:53:53 -0400 Received: from [212.23.3.142] (helo=rutherford.zen.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJcJJ-0002th-Im for bug-coreutils@gnu.org; Sun, 25 Sep 2005 15:37:17 -0400 Received: from [212.23.14.246] (helo=localhost.localdomain) by rutherford.zen.co.uk with esmtp (Exim 4.34) id 1EJcJH-0000eY-PZ for bug-coreutils@gnu.org; Sun, 25 Sep 2005 19:37:15 +0000 Received: by localhost.localdomain (Postfix, from userid 1000) id 03F11E2F14; Sun, 25 Sep 2005 20:36:48 +0100 (BST) Date: Sun, 25 Sep 2005 20:36:48 +0100 From: "Dr. David Alan Gilbert" To: bug-coreutils@gnu.org Message-ID: <20050925193648.GA8174@gallifrey> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/2.6.10-5-k7-smp (i686) X-Uptime: 20:30:32 up 1 day, 8:21, 1 user, load average: 2.33, 2.11, 2.03 User-Agent: Mutt/1.5.6+20040907i X-Originating-Rutherford-IP: [212.23.14.246] Subject: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 19:55:36 -0000 Hi, In the info pages for 'mv' is the following statement: --------------------------------------------------------------------------- _Warning_: If you try to move a symlink that points to a directory, and you specify the symlink with a trailing slash, then `mv' doesn't move the symlink but instead moves the directory referenced by the symlink. *Note Trailing slashes::. --------------------------------------------------------------------------- Hmm ok - so I try: $ mkdir a b $ ln -s $PWD/a sym $ mv sym/ b mv: cannot move `sym/' to `b/sym': Not a directory The 'mv' is straight out of recent cvs. I'm in an ext3 filesystem on Linux (Ubuntu). Am I misunderstanding something about that warning or is this a bug? Dave -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \ \ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex / \ _________________________|_____ http://www.treblig.org |_______/ From MAILER-DAEMON Sun Sep 25 17:02:14 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJddU-0003T6-UT for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 17:02:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJddR-0003R9-0r for bug-coreutils@gnu.org; Sun, 25 Sep 2005 17:02:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJddO-0003PH-Kc for bug-coreutils@gnu.org; Sun, 25 Sep 2005 17:02:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJdZL-0001WY-6s for bug-coreutils@gnu.org; Sun, 25 Sep 2005 16:57:55 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJdFx-00015r-Mp for bug-coreutils@gnu.org; Sun, 25 Sep 2005 16:37:53 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 628E4C32; Sun, 25 Sep 2005 22:37:52 +0200 (CEST) From: Jim Meyering To: "Dr. David Alan Gilbert" In-Reply-To: <20050925193648.GA8174@gallifrey> (David Alan Gilbert's message of "Sun, 25 Sep 2005 20:36:48 +0100") References: <20050925193648.GA8174@gallifrey> Date: Sun, 25 Sep 2005 22:37:52 +0200 Message-ID: <874q88x4rj.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2005 21:02:10 -0000 "Dr. David Alan Gilbert" wrote: > In the info pages for 'mv' is the following statement: > --------------------------------------------------------------------------- > _Warning_: If you try to move a symlink that points to a directory, > and you specify the symlink with a trailing slash, then `mv' doesn't > move the symlink but instead moves the directory referenced by the > symlink. *Note Trailing slashes::. > --------------------------------------------------------------------------- ... > $ mkdir a b > $ ln -s $PWD/a sym > $ mv sym/ b > mv: cannot move `sym/' to `b/sym': Not a directory > > The 'mv' is straight out of recent cvs. I'm in an ext3 filesystem > on Linux (Ubuntu). > > Am I misunderstanding something about that warning or is this > a bug? It depends on the semantics of the rename syscall. And those semantics vary from system to system. On older linux systems (probably 2.4.x, certainly 2.2.20, which I've just tested) your mv command renames `a' to b/sym. Losing systems probably deserve a configure-time test and a rename wrapper to correct for the unexpected behavior. From MAILER-DAEMON Sun Sep 25 21:05:22 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJhQn-00067S-JB for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:05:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJhQi-00065G-FQ for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:05:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJhQd-00062T-L6 for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:05:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJhQd-00061D-6S for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:05:11 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJhQA-0007Bo-6H for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:04:42 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8Q14c424735; Sun, 25 Sep 2005 18:04:38 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJhQ6-0003qL-4S; Sun, 25 Sep 2005 18:04:38 -0700 To: t_w_s@web.de References: <431411BF.9090705@web.de> From: Paul Eggert Date: Sun, 25 Sep 2005 18:04:38 -0700 In-Reply-To: <431411BF.9090705@web.de> (Thorsten W. Schmidt's message of "Tue, 30 Aug 2005 09:58:55 +0200") Message-ID: <87fyrsy6zd.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: CP Proposal - Benchmark + source code X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 01:05:18 -0000 >From the numbers you published in your email it appears that the big win on your examples with 'cp' comes from O_DIRECT, and that there's a mild improvement from O_STREAMING. However, my understanding is that O_STREAMING is a dead end (see ) and that they have merged posix_fadvise() into Linux 2.6. Did you try POSIX_FADV_SEQUENTIAL as well? It seems to me that POSIX_FADV_NOREUSE | POSIX_FADV_SEQUENTIAL would be a closer POSIX approximation to what "cp" needs than POSIX_FADV_NOREUSE by itself. I don't understand why POSIX_FADV_NOREUSE | POSIX_FADV_SEQUENTIAL would be so much worse than O_DIRECT, if they're properly implemented. Perhaps you could elaborate? From MAILER-DAEMON Sun Sep 25 21:31:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJhqS-0006NJ-V0 for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:31:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJhqO-0006K0-B9 for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:31:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJhqK-0006Gm-KF for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:31:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJhqH-00066V-Ax for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:31:41 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJhin-00089I-EQ for bug-coreutils@gnu.org; Sun, 25 Sep 2005 21:23:57 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8Q1Nt425508; Sun, 25 Sep 2005 18:23:55 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJhil-0003qa-Jy; Sun, 25 Sep 2005 18:23:55 -0700 To: Mike Frysinger References: <200508300009.27306.vapier@gentoo.org> From: Paul Eggert Date: Sun, 25 Sep 2005 18:23:55 -0700 In-Reply-To: <200508300009.27306.vapier@gentoo.org> (Mike Frysinger's message of "Tue, 30 Aug 2005 00:09:27 -0400") Message-ID: <87br2gy638.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 01:31:50 -0000 Mike Frysinger writes: > i was going through some patches Gentoo has for coreutils to figure out which > are outdated/pointless/etc... with 5.3.0 when i came across this patch from > Mandrake: > --- src/ls.c > +++ src/ls.c > @@ -1612,5 +1612,7 @@ > > if (! style) > if (! (style = getenv ("TIME_STYLE"))) > + if (getenv ("POSIXLY_CORRECT")) > style = "posix-long-iso"; > + else style = "locale"; > > > ignoring the broken formatting, i wonder if this change has been sent to the > list before for consideration (and i just couldnt find it in the archives) ? I don't recall seeing it, no. > the idea seems OK to me; the `ls -l` default format follows the > user's locale settings unless the env var POSIXLY_CORRET is set in > which case we go with the standard 'posix-long-iso' format I don't see why POSIXLY_CORRECT should affect the behavior here. POSIXLY_CORRECT is intended for places where the GNU default is a behavior that does not conform to POSIX, but the GNU default (--time-style='posix-long-iso') does conform. I suspect that Mandrake patch was put in by someone who wanted --time-style='locale' to be the default, and thought that the only reason --time-style='posix-long-iso' is the default is because POSIX requires this. But that's not the case: POSIX would allow either time-style to be the default. When I wrote that code back in 2002, I wanted posix-long-iso to be the default for the benefit of Emacs. Emacs's dired module parses dates, but it misparses random dates generated in random locales (e.g., dates based on the Japanese emperor's date of accession). Having the default be posix-long-iso avoided most of this problem. I figured other programs would have problems similar to Emacs. If I recall correctly CVS Emacs now does this a different way and may no longer need posix-long-iso to be the default, but the latest stable Emacs still has the problem. (My memory could be wrong, but someone should check this before making changes.) At any rate if other programs rely on the current behavior I'd be a bit leery about changing the default to --time-style=locale -- though if it works well for Mandrake that's an argument that it wouldn't hurt much to change it. From MAILER-DAEMON Sun Sep 25 23:40:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJjr0-0001Pc-U4 for mharc-bug-coreutils@gnu.org; Sun, 25 Sep 2005 23:40:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJjqm-0001Ki-Am for bug-coreutils@gnu.org; Sun, 25 Sep 2005 23:40:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJjqc-0001FN-31 for bug-coreutils@gnu.org; Sun, 25 Sep 2005 23:40:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJjqb-0001EM-Mq for bug-coreutils@gnu.org; Sun, 25 Sep 2005 23:40:09 -0400 Received: from [134.68.220.30] (helo=smtp.gentoo.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJjnr-000066-GO for bug-coreutils@gnu.org; Sun, 25 Sep 2005 23:37:19 -0400 Received: from localhost ([127.0.0.1] helo=home.wh0rd.org) by smtp.gentoo.org with esmtp (Exim 4.43) id 1EJjnp-00073s-Nj for bug-coreutils@gnu.org; Mon, 26 Sep 2005 03:37:17 +0000 Received: (qmail 1070 invoked from network); 25 Sep 2005 23:34:42 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 25 Sep 2005 23:34:42 -0400 From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Date: Sun, 25 Sep 2005 23:37:54 -0400 User-Agent: KMail/1.8.2 References: <200508300009.27306.vapier@gentoo.org> <87br2gy638.fsf@penguin.cs.ucla.edu> In-Reply-To: <87br2gy638.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509252337.54089.vapier@gentoo.org> Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 03:40:27 -0000 On Sunday 25 September 2005 09:23 pm, Paul Eggert wrote: > At any rate if other > programs rely on the current behavior I'd be a bit leery about > changing the default to --time-style=locale -- though if it works well > for Mandrake that's an argument that it wouldn't hurt much to change > it. if it helps get this change accepted, Gentoo has been using this patch too for quite some time too ;) -mike From MAILER-DAEMON Mon Sep 26 00:59:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJl0y-0004g2-Up for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 00:54:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJl0G-0004Zd-JZ for bug-coreutils@gnu.org; Mon, 26 Sep 2005 00:54:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJl04-0004VX-TG for bug-coreutils@gnu.org; Mon, 26 Sep 2005 00:54:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJl04-0004Od-8r for bug-coreutils@gnu.org; Mon, 26 Sep 2005 00:54:00 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJknT-0003og-JS for bug-coreutils@gnu.org; Mon, 26 Sep 2005 00:40:59 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8Q4er404598; Sun, 25 Sep 2005 21:40:55 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJknN-0003tP-4h; Sun, 25 Sep 2005 21:40:53 -0700 To: Mike Frysinger References: <200508300009.27306.vapier@gentoo.org> <87br2gy638.fsf@penguin.cs.ucla.edu> <200509252337.54089.vapier@gentoo.org> From: Paul Eggert Date: Sun, 25 Sep 2005 21:40:53 -0700 In-Reply-To: <200509252337.54089.vapier@gentoo.org> (Mike Frysinger's message of "Sun, 25 Sep 2005 23:37:54 -0400") Message-ID: <87r7bco2zu.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 04:54:43 -0000 Mike Frysinger writes: > Gentoo has been using this patch too for > quite some time too ;) Debian doesn't have the patch, and I suspect other distributions don't either. So we have a real split here. At the very least, Mandrake and Gentoo's patch should not look at POSIXLY_CORRECT, as this is not a POSIX-conformance issue. If they want to change the default, they should simply replace if (! (style = getenv ("TIME_STYLE"))) style = "posix-long-iso"; with if (! (style = getenv ("TIME_STYLE"))) style = "locale"; without looking at POSIXLY_CORRECT. Could you please have this fixed in the source? (I suspect it's easy for you to fix this with Gentoo at any rate....) One possibility is to make this all easier to configure without patching the source, e.g., with an #ifndef TIME_STYLE_DEFAULT # define TIME_STYLE_DEFAULT "posix-long-iso" #endif ... if (! (style = getenv ("TIME_STYLE"))) style = TIME_STYLE_DEFAULT; in the source code, and then let Mandrake and Gentoo configure with the appropriate CPPFLAGS. But before we go off the deep end here, why exactly is this change a good idea? If it's just a personal preference, then the TIME_STYLE environment variable addresses the issue, no? Perhaps Mandrake and/or Gentoo could simply set TIME_STYLE=locale in their users' standard startup files? From MAILER-DAEMON Mon Sep 26 01:04:48 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJlAW-0000Hp-7j for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:04:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJlAR-0000Fv-R5 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:04:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJlAM-0000Cy-8T for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:04:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJlAM-0000Ba-1g for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:04:38 -0400 Received: from [134.68.220.30] (helo=smtp.gentoo.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJl7g-0005bV-5f for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:01:52 -0400 Received: from localhost ([127.0.0.1] helo=home.wh0rd.org) by smtp.gentoo.org with esmtp (Exim 4.43) id 1EJl7d-0002lx-VX for bug-coreutils@gnu.org; Mon, 26 Sep 2005 05:01:50 +0000 Received: (qmail 8534 invoked from network); 26 Sep 2005 00:59:14 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 26 Sep 2005 00:59:14 -0400 From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Date: Mon, 26 Sep 2005 01:02:27 -0400 User-Agent: KMail/1.8.2 References: <200508300009.27306.vapier@gentoo.org> <200509252337.54089.vapier@gentoo.org> <87r7bco2zu.fsf@penguin.cs.ucla.edu> In-Reply-To: <87r7bco2zu.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509260102.27169.vapier@gentoo.org> Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 05:04:46 -0000 On Monday 26 September 2005 12:40 am, Paul Eggert wrote: > Mike Frysinger writes: > > Gentoo has been using this patch too for > > quite some time too ;) > > Debian doesn't have the patch, and I suspect other distributions don't > either. So we have a real split here. RedHat/Fedora have been using it for quite sometime i think ... it's called 'fileutils-4.1.10-timestyle.patch' in their rpms, and i believe it dates back to before the big fileutils/textutils/sh-utils merge into coreutils ... > At the very least, Mandrake and Gentoo's patch should not look at > POSIXLY_CORRECT, as this is not a POSIX-conformance issue. If they > want to change the default, they should simply replace indeed ... i admit we just copied the patch straight from Mandrake and didnt fully investigate the POSIX aspects of it since as you pointed out, looking at the source quickly seems to imply that it is POSIX behavior to default to posix output style > if (! (style = getenv ("TIME_STYLE"))) > style = "posix-long-iso"; > > with > > if (! (style = getenv ("TIME_STYLE"))) > style = "locale"; > > without looking at POSIXLY_CORRECT. Could you please have this fixed > in the source? (I suspect it's easy for you to fix this with Gentoo > at any rate....) yep, i'll fix it in Gentoo in the next day or so, thanks for the pointers > One possibility is to make this all easier to configure without > patching the source, e.g., with an > > #ifndef TIME_STYLE_DEFAULT > # define TIME_STYLE_DEFAULT "posix-long-iso" > #endif > ... > > if (! (style = getenv ("TIME_STYLE"))) > style = TIME_STYLE_DEFAULT; > > in the source code, and then let Mandrake and Gentoo configure with > the appropriate CPPFLAGS. just as easy to patch as to setup a CPPFLAG i think ... > But before we go off the deep end here, why exactly is this change a > good idea? the idea is to make the default output as intuitive as possible ... imo, defaulting to one's locale time format instead of a POSIX one makes more sense ... but i wouldnt be suprised if others felt differently :) > If it's just a personal preference, then the TIME_STYLE > environment variable addresses the issue, no? Perhaps Mandrake and/or > Gentoo could simply set TIME_STYLE=locale in their users' standard > startup files? yes, that could be done, but one thing ive noticed working with Gentoo is that it's quite common for people to create new users 'by hand' ... that is, the skel dir isnt put into place quite as often as it should also, going back to the intuitive behavior i mentioned previously, i generally try to push changes upstream so everyone benefits rather than just Gentoo/whoever ... thus i started bugging you guys -mike From MAILER-DAEMON Mon Sep 26 01:22:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJlRj-0004vw-N1 for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:22:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJlRa-0004r0-6Z for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:22:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJlRT-0004mC-SY for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:22:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJlRS-0004hp-HJ for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:22:18 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJlOC-0006ZC-SR for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:18:57 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8Q5Il406332; Sun, 25 Sep 2005 22:18:48 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJlO3-0003uS-6u; Sun, 25 Sep 2005 22:18:47 -0700 To: "Tal V." References: <20050812174956.7ED0733B5E@sa3.bezeqint.net> From: Paul Eggert Date: Sun, 25 Sep 2005 22:18:47 -0700 In-Reply-To: <20050812174956.7ED0733B5E@sa3.bezeqint.net> (Tal V.'s message of "Fri, 12 Aug 2005 20:50:16 +0200") Message-ID: <87aci0o18o.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: Possible bug in sort utility X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 05:22:28 -0000 On 2005-08-12 "Tal V." writes: > When I sort a file by the second character in first field I have to > refer to the second character as to character number "1" (command > "sort 0.1 filename"). That can't be the syntax that you actually used. Perhaps your email client lopped off some characters? You need to use a syntax like "sort -k 1.2,1,2 filename". > But when I want to sort a file by the second character in second (or higher) > field I need to refer to the second character as to character number "2" > (command "sort 1.2 filename"). Again, this can't be the syntax you were actually using. In trying to decipher your email, my guess is that most likely you need to use sort's -b option; you might try reading up on how it works and why it's needed. From MAILER-DAEMON Mon Sep 26 01:56:19 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJlyK-0004vi-Hm for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:56:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJly2-0004rk-B2 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:55:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJlxy-0004qk-60 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:55:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJlxu-0004kd-VU for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:55:51 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJlxu-0000Yw-Ff for bug-coreutils@gnu.org; Mon, 26 Sep 2005 01:55:50 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8Q5tm407865; Sun, 25 Sep 2005 22:55:48 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJlxs-0003un-73; Sun, 25 Sep 2005 22:55:48 -0700 To: Mike Frysinger References: <200508300009.27306.vapier@gentoo.org> <200509252337.54089.vapier@gentoo.org> <87r7bco2zu.fsf@penguin.cs.ucla.edu> <200509260102.27169.vapier@gentoo.org> From: Paul Eggert Date: Sun, 25 Sep 2005 22:55:48 -0700 In-Reply-To: <200509260102.27169.vapier@gentoo.org> (Mike Frysinger's message of "Mon, 26 Sep 2005 01:02:27 -0400") Message-ID: <871x3cnziz.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 05:55:59 -0000 Mike Frysinger writes: >> But before we go off the deep end here, why exactly is this change a >> good idea? > > the idea is to make the default output as intuitive as possible ... imo, > defaulting to one's locale time format instead of a POSIX one makes more > sense ... but i wouldnt be suprised if others felt differently :) Yes, it is a problem and quite possibly the right thing depends on the locale and operating system. I should emphasize again, though, that the current coreutils default is not "a POSIX one" in the sense that you may be thinking. The coreutils default is an international format derived from ISO 8601. This ISO-8601-derived format does conform to POSIX, but just about any format would. Even if you change coreutils so that --time-style=locale is the default, coreutils is still defaulting to a format that is "a POSIX one". From MAILER-DAEMON Mon Sep 26 08:55:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJsVZ-0004sc-5D for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 08:55:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJsV4-0004cl-VO for bug-coreutils@gnu.org; Mon, 26 Sep 2005 08:54:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJsV1-0004Y4-8e for bug-coreutils@gnu.org; Mon, 26 Sep 2005 08:54:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJsV0-0004XO-GS for bug-coreutils@gnu.org; Mon, 26 Sep 2005 08:54:26 -0400 Received: from [204.127.202.64] (helo=sccrmhc13.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJsUw-0000QZ-NC for bug-coreutils@gnu.org; Mon, 26 Sep 2005 08:54:22 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc13) with ESMTP id <2005092612542001300a5tpre>; Mon, 26 Sep 2005 12:54:20 +0000 Message-ID: <4337EF7A.5030402@byu.net> Date: Mon, 26 Sep 2005 06:54:18 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Paul Eggert References: <87slvtk6qk.fsf@penguin.cs.ucla.edu> In-Reply-To: <87slvtk6qk.fsf@penguin.cs.ucla.edu> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: bug-coreutils@gnu.org Subject: Re: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 12:54:56 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Paul Eggert on 9/25/2005 12:21 AM: > > To help counteract this for futimes, we can have "touch -" touch the > standard output, i.e., it can invoke futimes on the standard output > rather than utimes on the file named "-". This is pretty > straightforward so I installed the following patch. Does this countradict POSIX, meaning that when POSIXLY_CORRECT, 'touch -' should be the same as 'touch ./-'? I couldn't see anything in POSIX that permits or forbids this change in semantics, although I agree that it seems useful. Also, it seems a bit strange that - maps to stdout, when it usually maps to stdin. - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDN+9684KuGfSFAYARAu2/AJ4tJallLselI81vWjx0jHQOfzHZsgCdHGX4 bmph540bev1zv4umlGgYXAU= =QbTR -----END PGP SIGNATURE----- From MAILER-DAEMON Mon Sep 26 10:06:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJtcg-0002wI-Fx for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 10:06:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJtce-0002v4-7y for bug-coreutils@gnu.org; Mon, 26 Sep 2005 10:06:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJtcc-0002tu-Qv for bug-coreutils@gnu.org; Mon, 26 Sep 2005 10:06:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJtb3-0001oE-Se; Mon, 26 Sep 2005 10:04:45 -0400 Received: from [81.80.162.195] (helo=ftp.ilog.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJtWD-0008Nm-L2; Mon, 26 Sep 2005 09:59:45 -0400 Received: from laposte.ilog.fr (cerbere-qfe0 [81.80.162.193]) by ftp.ilog.fr (8.13.4/8.13.3) with ESMTP id j8QDxg28009105; Mon, 26 Sep 2005 15:59:42 +0200 (MET DST) Received: from honolulu.ilog.fr ([172.16.15.121]) by laposte.ilog.fr (8.13.1/8.13.1) with ESMTP id j8QDxa8K026172; Mon, 26 Sep 2005 15:59:36 +0200 (MET DST) Received: from localhost (localhost [127.0.0.1]) by honolulu.ilog.fr (Postfix) with ESMTP id DA8A61BB4A; Mon, 26 Sep 2005 13:55:34 +0000 (UTC) From: Bruno Haible To: Paul Eggert , bug-coreutils@gnu.org Date: Mon, 26 Sep 2005 15:55:33 +0200 User-Agent: KMail/1.5 References: <8764sqkq54.fsf@penguin.cs.ucla.edu> In-Reply-To: <8764sqkq54.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509261555.33325.bruno@clisp.org> Cc: bug-gnulib@gnu.org Subject: Re: [bug-gnulib] problem with mbchar module on OpenBSD X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 14:06:25 -0000 Paul Eggert wrote: > I installed the following patch into coreutils, which is about the > same as Derek Price's proposed gnulib patch > . Thanks for verifying that this works. (I still don't have access to an OpenBSD box.) Actually the problem is worse: The 'Include:' section of the modules mbchar, mbfile, mbiter, mbuiter was incorrectly specified. It appeared to allow including mbchar.h, mbfile.h, mbiter.h on any platform, which does not work. I committed this fix into gnulib. The mbchar.m4 part should be equivalent to Yoann's fix. Bruno 2005-09-26 Bruno Haible * modules/mbchar (Include): Mention that HAVE_WCHAR_H && HAVE_WCTYPE_H is necessary. (lib_SOURCES): Remove mbchar.c. * modules/mbfile (Include): Mention that HAVE_MBRTOWC is necessary. (Files): Add m4/mbrtowc.m4. * modules/mbiter: Likewise. * modules/mbuiter: Likewise. * m4/mbchar.m4 (gl_MBCHAR): Check for wchar.h and wctype.h. Don't compile mbchar.c if they are not both present. * m4/mbfile.m4 (gl_MBFILE): Require gl_FUNC_MBRTOWC. * m4/mbiter.m4 (gl_MBITER): Likewise. * m4/strstr.m4 (gl_PREREQ_STRSTR): Use AC_REQUIRE. * m4/strcasestr.m4 (gl_PREREQ_STRCASESTR): Likewise. * m4/strcase.m4 (gl_PREREQ_STRCASECMP): Likewise. *** modules/mbchar 16 Aug 2005 12:06:55 -0000 1.1 --- modules/mbchar 26 Sep 2005 13:51:52 -0000 *************** *** 13,22 **** gl_MBCHAR Makefile.am: ! lib_SOURCES += mbchar.h mbchar.c Include: ! "mbchar.h" License: LGPL --- 13,24 ---- gl_MBCHAR Makefile.am: ! lib_SOURCES += mbchar.h Include: ! #if HAVE_WCHAR_H && HAVE_WCTYPE_H ! #include "mbchar.h" ! #endif License: LGPL *** modules/mbfile 16 Aug 2005 12:09:52 -0000 1.1 --- modules/mbfile 26 Sep 2005 13:51:52 -0000 *************** *** 4,9 **** --- 4,10 ---- Files: lib/mbfile.h m4/mbfile.m4 + m4/mbrtowc.m4 Depends-on: mbchar *************** *** 16,22 **** lib_SOURCES += mbfile.h Include: ! "mbfile.h" License: LGPL --- 17,25 ---- lib_SOURCES += mbfile.h Include: ! #if HAVE_MBRTOWC ! #include "mbfile.h" ! #endif License: LGPL *** modules/mbiter 16 Aug 2005 12:08:40 -0000 1.1 --- modules/mbiter 26 Sep 2005 13:51:52 -0000 *************** *** 4,9 **** --- 4,10 ---- Files: lib/mbiter.h m4/mbiter.m4 + m4/mbrtowc.m4 Depends-on: mbchar *************** *** 16,22 **** lib_SOURCES += mbiter.h Include: ! "mbiter.h" License: LGPL --- 17,25 ---- lib_SOURCES += mbiter.h Include: ! #if HAVE_MBRTOWC ! #include "mbiter.h" ! #endif License: LGPL *** modules/mbuiter 17 Aug 2005 13:58:33 -0000 1.1 --- modules/mbuiter 26 Sep 2005 13:51:52 -0000 *************** *** 4,9 **** --- 4,10 ---- Files: lib/mbuiter.h m4/mbiter.m4 + m4/mbrtowc.m4 Depends-on: mbchar *************** *** 17,23 **** lib_SOURCES += mbuiter.h Include: ! "mbuiter.h" License: LGPL --- 18,26 ---- lib_SOURCES += mbuiter.h Include: ! #if HAVE_MBRTOWC ! #include "mbuiter.h" ! #endif License: LGPL *** m4/mbchar.m4 16 Aug 2005 12:06:55 -0000 1.1 --- m4/mbchar.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # mbchar.m4 serial 1 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # mbchar.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 10,14 **** AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_GNU_SOURCE]) ! : ]) --- 10,20 ---- AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_GNU_SOURCE]) ! dnl The following line is that so the user can test ! dnl HAVE_WCHAR_H && HAVE_WCTYPE_H before #include "mbchar.h". ! AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) ! dnl Compile mbchar.c only if HAVE_WCHAR_H && HAVE_WCTYPE_H. ! if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then ! AC_LIBOBJ([mbchar]) ! fi ]) *** m4/mbfile.m4 16 Aug 2005 12:09:52 -0000 1.1 --- m4/mbfile.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # mbfile.m4 serial 1 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # mbfile.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 10,14 **** --- 10,17 ---- AC_DEFUN([gl_MBFILE], [ AC_REQUIRE([AC_TYPE_MBSTATE_T]) + dnl The following line is that so the user can test HAVE_MBRTOWC before + dnl #include "mbfile.h". + AC_REQUIRE([gl_FUNC_MBRTOWC]) : ]) *** m4/mbiter.m4 16 Aug 2005 12:08:40 -0000 1.1 --- m4/mbiter.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # mbiter.m4 serial 1 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # mbiter.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 10,14 **** --- 10,17 ---- AC_DEFUN([gl_MBITER], [ AC_REQUIRE([AC_TYPE_MBSTATE_T]) + dnl The following line is that so the user can test HAVE_MBRTOWC before + dnl #include "mbiter.h" or "mbuiter.h". + AC_REQUIRE([gl_FUNC_MBRTOWC]) : ]) *** m4/strstr.m4 15 Sep 2005 16:25:48 -0000 1.5 --- m4/strstr.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # strstr.m4 serial 4 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # strstr.m4 serial 5 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 14,18 **** # Prerequisites of lib/strstr.c. AC_DEFUN([gl_PREREQ_STRSTR], [ ! gl_FUNC_MBRTOWC ]) --- 14,19 ---- # Prerequisites of lib/strstr.c. AC_DEFUN([gl_PREREQ_STRSTR], [ ! AC_REQUIRE([gl_FUNC_MBRTOWC]) ! : ]) *** m4/strcasestr.m4 17 Aug 2005 14:09:19 -0000 1.1 --- m4/strcasestr.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # strcasestr.m4 serial 1 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # strcasestr.m4 serial 2 dnl Copyright (C) 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 15,19 **** # Prerequisites of lib/strcasestr.c. AC_DEFUN([gl_PREREQ_STRCASESTR], [ ! gl_FUNC_MBRTOWC ]) --- 15,20 ---- # Prerequisites of lib/strcasestr.c. AC_DEFUN([gl_PREREQ_STRCASESTR], [ ! AC_REQUIRE([gl_FUNC_MBRTOWC]) ! : ]) *** m4/strcase.m4 16 Aug 2005 12:21:21 -0000 1.3 --- m4/strcase.m4 26 Sep 2005 13:51:52 -0000 *************** *** 1,4 **** ! # strcase.m4 serial 2 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # strcase.m4 serial 3 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 29,35 **** # Prerequisites of lib/strcasecmp.c. AC_DEFUN([gl_PREREQ_STRCASECMP], [ ! gl_FUNC_MBRTOWC ]) # Prerequisites of lib/strncasecmp.c. --- 29,36 ---- # Prerequisites of lib/strcasecmp.c. AC_DEFUN([gl_PREREQ_STRCASECMP], [ ! AC_REQUIRE([gl_FUNC_MBRTOWC]) ! : ]) # Prerequisites of lib/strncasecmp.c. From MAILER-DAEMON Mon Sep 26 13:23:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJwhN-0001My-9e for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:23:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJwhL-0001LD-9h for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:23:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJwhJ-0001KI-Gb for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:23:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJwgl-00012b-TC for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:52 -0400 Received: from [195.92.253.2] (helo=ZenIV.linux.org.uk) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EJwbn-000749-D3 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:17:43 -0400 Received: from penguin42 by ZenIV.linux.org.uk with local (Exim 4.52 #1 (Red Hat Linux)) id 1EJwbl-0000dz-1F; Mon, 26 Sep 2005 18:17:41 +0100 Date: Mon, 26 Sep 2005 18:17:41 +0100 From: "Dr. David Alan Gilbert" To: Jim Meyering Message-ID: <20050926171740.GA8154@gallifrey> References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874q88x4rj.fsf@rho.meyering.net> User-Agent: Mutt/1.4.1i X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/2.6.11-1.14_FC3 (i686) X-Uptime: 18:15:59 up 24 days, 5:42, 70 users, load average: 0.05, 0.06, 0.01 Sender: Cc: bug-coreutils@gnu.org Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 17:23:27 -0000 * Jim Meyering (jim@meyering.net) wrote: > > $ mkdir a b > > $ ln -s $PWD/a sym > > $ mv sym/ b > > mv: cannot move `sym/' to `b/sym': Not a directory > > > > The 'mv' is straight out of recent cvs. I'm in an ext3 filesystem > > on Linux (Ubuntu). > > > > Am I misunderstanding something about that warning or is this > > a bug? > > It depends on the semantics of the rename syscall. > And those semantics vary from system to system. > On older linux systems (probably 2.4.x, certainly 2.2.20, which > I've just tested) your mv command renames `a' to b/sym. OK, as far as I can tell on the 2.6.x machines I've tried it on it doesn't. > Losing systems probably deserve a configure-time test and a rename > wrapper to correct for the unexpected behavior. Nod. Perhaps the warning needs a warning that it can't be relied on? Dave -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \ \ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex / \ _________________________|_____ http://www.treblig.org |_______/ From MAILER-DAEMON Mon Sep 26 13:28:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJwmh-0003dd-9h for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:28:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJwjZ-0002LF-Aw for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:25:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJwgf-00019o-IS for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:53 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJwgc-00012b-Gb for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:42 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJwcy-0007BJ-BC for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:18:56 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8QHIr413849; Mon, 26 Sep 2005 10:18:53 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJwcv-00044S-3G; Mon, 26 Sep 2005 10:18:53 -0700 To: t_w_s@web.de References: <431411BF.9090705@web.de> <87fyrsy6zd.fsf@penguin.cs.ucla.edu> <4337B3B4.5080909@web.de> From: Paul Eggert Date: Mon, 26 Sep 2005 10:18:53 -0700 In-Reply-To: <4337B3B4.5080909@web.de> (Thorsten W. Schmidt's message of "Mon, 26 Sep 2005 10:39:16 +0200") Message-ID: <873bnroigy.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: CP Proposal - Benchmark + source code X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 17:28:57 -0000 Thanks for the further measurements. It sounds like in the current version of GNU/Linux, POSIX_FADV_NOREUSE | POSIX_FADV_SEQUENTIAL is still much slower than O_DIRECT, even with kernel tweaking, so that is an argument for having a new option for 'cp', 'mv', and 'install'. It would be helpful to know, though, why the performance difference is so great -- can you ask the kernel folks about that? If we head this direction, one idea is to mimic the iflag and oflag options that are already in 'dd'. Thus: cp --iflag=direct --oflag=direct SOURCE DEST would have the effect that you want. One could also specify other combinations, e.g., --iflag='direct,noctty'. Perhaps it would also make sense to have a combined --ioflag=direct option, for convenience. From MAILER-DAEMON Mon Sep 26 14:25:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EJxfX-0005VK-Gi for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 14:25:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJxfP-0005S4-IC for bug-coreutils@gnu.org; Mon, 26 Sep 2005 14:25:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJxfM-0005QL-Ik for bug-coreutils@gnu.org; Mon, 26 Sep 2005 14:25:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJxfL-0005PW-OB for bug-coreutils@gnu.org; Mon, 26 Sep 2005 14:25:27 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJxeo-0008M9-Fx for bug-coreutils@gnu.org; Mon, 26 Sep 2005 14:24:54 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8QIOo420465; Mon, 26 Sep 2005 11:24:51 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EJxek-00048E-EK; Mon, 26 Sep 2005 11:24:50 -0700 To: Eric Blake References: <87slvtk6qk.fsf@penguin.cs.ucla.edu> <4337EF7A.5030402@byu.net> From: Paul Eggert Date: Mon, 26 Sep 2005 11:24:50 -0700 In-Reply-To: <4337EF7A.5030402@byu.net> (Eric Blake's message of "Mon, 26 Sep 2005 06:54:18 -0600") Message-ID: <87u0g7n0ul.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 18:25:36 -0000 Eric Blake writes: > According to Paul Eggert on 9/25/2005 12:21 AM: >> we can have "touch -" touch the standard output... > > Does this countradict POSIX, Not as far as I can see. Admittedly this is a confusing area. Here's the argument. POSIX 1003.1 section 12.2 says this: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used only to mean standard input (or standard output when it is clear from context that an output file is being specified). This provision arguably applies to "touch", since "touch FILE" opens FILE for writing if FILE does not exist. The counterargument would be, though, that standard output does exist in the case where "touch -" is useful, and "touch FILE" does not open FILE for writing if FILE exists, so Guideline 13 does not apply here. However, even if one concedes this counterargument, one is left with the conclusion that POSIX does not prohibit "touch -" from affecting standard output, since Guideline 13 is silent about what "-" means in a file name context when the file is not opened for either reading or writing. Hence an implementation is allowed to define "touch -" to touch standard output. A similar argument would conclude that "chmod 644 -" and "chown root -" can affect standard output, if the implementation so chooses. (I haven't implemented that yet, though.) > Also, it seems a bit strange that - maps to stdout, when it usually > maps to stdin. One usually thinks of "touch FILE" as writing to FILE. Historically that's how "touch" actually worked in all cases, though nowadays a utime-like function is used when FILE exists. So it's somewhat more natural to map it to standard output. There is some precedent for this, e.g., "tee -". PS. I should mention that "touch -" was a way-past-the-last-minute change and might be withdrawn before the next release -- I'm afraid I overstepped the bounds on the schedule. I'm still waiting for Jim's word on whether to withdraw it, at least for now. From MAILER-DAEMON Mon Sep 26 17:38:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK0gT-0001xo-Hc for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 17:38:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK0gP-0001uv-2U for bug-coreutils@gnu.org; Mon, 26 Sep 2005 17:38:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK0gO-0001tq-39 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 17:38:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK0dE-0008DT-I0; Mon, 26 Sep 2005 17:35:28 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK0ZT-0000fG-Jo; Mon, 26 Sep 2005 17:31:35 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8QLVW407969; Mon, 26 Sep 2005 14:31:32 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EK0ZQ-00013C-L3; Mon, 26 Sep 2005 14:31:32 -0700 To: bug-coreutils@gnu.org, bug-gnulib@gnu.org References: <8764sqkq54.fsf@penguin.cs.ucla.edu> <200509261555.33325.bruno@clisp.org> From: Paul Eggert Date: Mon, 26 Sep 2005 14:31:32 -0700 In-Reply-To: <200509261555.33325.bruno@clisp.org> (Bruno Haible's message of "Mon, 26 Sep 2005 15:55:33 +0200") Message-ID: <87oe6fms7f.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: Re: [bug-gnulib] problem with mbchar module on OpenBSD X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 21:38:47 -0000 Bruno Haible writes: > I committed this fix into gnulib. The mbchar.m4 part should be equivalent > to Yoann's fix. Thanks; I've verified that this works with coreutils and OpenBSD 3.4. I haven't committed it to coreutils yet, though, since currently we're trying to minimize changes before a release, and in the coreutils context I don't think the patch affects anything. From MAILER-DAEMON Mon Sep 26 19:11:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK280-0005lU-3a for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 19:11:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK27u-0005ht-4E for bug-coreutils@gnu.org; Mon, 26 Sep 2005 19:11:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK27r-0005gS-5M for bug-coreutils@gnu.org; Mon, 26 Sep 2005 19:11:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK27q-0005gA-Ru for bug-coreutils@gnu.org; Mon, 26 Sep 2005 19:11:10 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK27h-0000QG-DL for bug-coreutils@gnu.org; Mon, 26 Sep 2005 19:11:01 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8QNB0416489 for ; Mon, 26 Sep 2005 16:11:00 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EK27g-0005wW-7U for bug-coreutils@gnu.org; Mon, 26 Sep 2005 16:11:00 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Mon, 26 Sep 2005 16:11:00 -0700 Message-ID: <87d5mvmnln.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: "touch -" test cases, and fixes for "touch -c - >&-" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 23:11:16 -0000 I some test cases for "touch". They caused me to discover one minor bug in the old "touch" code; "close(fd)" could clobber errno (this was more by code inspection than anything else). Also, they uncovered some portability mishaps (causing suboptimal code or incorrect errno values in diagnostics). Also, they uncovered the fact that "touch -c - >&-" should not report an error number, by analogy with "touch -c no-such-file". Here's the patch I installed: 2005-09-25 Paul Eggert * lib/utimens.c: Include unistd.h, for dup2. (futimens): Fix typo: HAVE_FUTIMESAT was misspelled in an #if. (futimens) [! HAVE_FUTIMESAT]: If !file, set errno before returning -1. * src/touch.c (touch): Handle "touch -c - >&-" by checking for EBADF and ENOSYS. Do not pass "-" to futimens; pass NULL instead. If close (STDIN_FILENO) fails, report the error separately instead of letting the 'close' pollute errno. * tests/touch/empty-file: Test "touch -" too. * tests/touch/no-create-missing: Likewise. * tests/touch/read-only: Likewise. Index: lib/utimens.c =================================================================== RCS file: /fetish/cu/lib/utimens.c,v retrieving revision 1.9 diff -p -u -r1.9 utimens.c --- lib/utimens.c 25 Sep 2005 06:08:45 -0000 1.9 +++ lib/utimens.c 26 Sep 2005 22:57:54 -0000 @@ -26,6 +26,7 @@ #include #include +#include #if HAVE_UTIME_H # include @@ -113,11 +114,24 @@ futimens (int fd ATTRIBUTE_UNUSED, # endif #endif -#if ! HAVE_FUTIMES_AT +#if ! HAVE_FUTIMESAT if (!file) { +# if ! (HAVE_WORKING_UTIMES && HAVE_FUTIMES) errno = ENOSYS; +# endif + + /* Prefer EBADF to ENOSYS if both error numbers apply. */ + if (errno == ENOSYS) + { + int fd2 = dup (fd); + int dup_errno = errno; + if (0 <= fd2) + close (fd2); + errno = (fd2 < 0 && dup_errno == EBADF ? EBADF : ENOSYS); + } + return -1; } Index: src/touch.c =================================================================== RCS file: /fetish/cu/src/touch.c,v retrieving revision 1.135 diff -p -u -r1.135 touch.c --- src/touch.c 25 Sep 2005 06:12:21 -0000 1.135 +++ src/touch.c 26 Sep 2005 22:57:54 -0000 @@ -154,7 +154,7 @@ touch (const char *file) error (0, open_errno, _("creating %s"), quote (file)); else { - if (no_create && errno == ENOENT) + if (no_create && (errno == ENOENT || errno == EBADF)) return true; error (0, errno, _("failed to get attributes of %s"), quote (file)); @@ -182,9 +182,23 @@ touch (const char *file) t = timespec; } - ok = (futimens (fd, file, t) == 0); + ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0); + if (fd == STDIN_FILENO) - ok &= (close (fd) == 0); + { + if (close (STDIN_FILENO) != 0) + { + error (0, errno, _("closing %s"), quote (file)); + return false; + } + } + else if (fd == STDOUT_FILENO) + { + /* Do not diagnose "touch -c - >&-". */ + if (!ok && errno == EBADF && no_create + && change_times == (CH_ATIME | CH_MTIME)) + return true; + } if (!ok) { Index: tests/touch/empty-file =================================================================== RCS file: /fetish/cu/tests/touch/empty-file,v retrieving revision 1.7 diff -p -u -r1.7 empty-file --- tests/touch/empty-file 2 Feb 2000 14:04:47 -0000 1.7 +++ tests/touch/empty-file 26 Sep 2005 22:57:54 -0000 @@ -22,11 +22,13 @@ fail=0 framework_failure=0 for d in $TOUCH_DIR_LIST; do - rm -rf $d/a $d/b + rm -rf $d/a $d/b $d/c > $d/a || framework_failure=1 test -f $d/a || framework_failure=1 > $d/b || framework_failure=1 test -f $d/b || framework_failure=1 + > $d/c || framework_failure=1 + test -f $d/c || framework_failure=1 done if test $framework_failure = 1; then @@ -49,7 +51,12 @@ for d in $TOUCH_DIR_LIST; do set x `ls -t $d/a $d/b` test "$*" = "x $d/b $d/a" || fail=1 - rm -rf $d/a $d/b + if touch - 1< $d/c 2> /dev/null; then + set x `ls -t $d/a $d/c` + test "$*" = "x $d/c $d/a" || fail=1 + fi + + rm -rf $d/a $d/b $d/c done if test $fail != 0; then Index: tests/touch/no-create-missing =================================================================== RCS file: /fetish/cu/tests/touch/no-create-missing,v retrieving revision 1.4 diff -p -u -r1.4 no-create-missing --- tests/touch/no-create-missing 23 Jun 2004 15:07:05 -0000 1.4 +++ tests/touch/no-create-missing 26 Sep 2005 22:57:54 -0000 @@ -25,5 +25,8 @@ fail=0 touch -c no-file > /dev/null 2>&1 || fail=1 touch -cm no-file > /dev/null 2>&1 || fail=1 touch -ca no-file > /dev/null 2>&1 || fail=1 +touch -c - >&- 2> /dev/null || fail=1 +touch -cm - >&- 2> /dev/null || fail=1 +touch -ca - >&- 2> /dev/null || fail=1 (exit $fail); exit $fail Index: tests/touch/read-only =================================================================== RCS file: /fetish/cu/tests/touch/read-only,v retrieving revision 1.1 diff -p -u -r1.1 read-only --- tests/touch/read-only 26 Sep 2005 07:31:57 -0000 1.1 +++ tests/touch/read-only 26 Sep 2005 22:57:54 -0000 @@ -29,4 +29,6 @@ fail=0 touch read-only || fail=1 +touch - 1< read-only 2> /dev/null && { test ! -f - || fail=1; } + (exit $fail); exit $fail From MAILER-DAEMON Mon Sep 26 21:43:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK4Ur-0006vG-KI for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 21:43:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK4Qy-00064E-Ng for bug-coreutils@gnu.org; Mon, 26 Sep 2005 21:39:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK4Qm-0005yc-Cx for bug-coreutils@gnu.org; Mon, 26 Sep 2005 21:38:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK4Qm-0005tj-2Z for bug-coreutils@gnu.org; Mon, 26 Sep 2005 21:38:52 -0400 Received: from [134.68.220.30] (helo=smtp.gentoo.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EK4Er-0001pU-Np for bug-coreutils@gnu.org; Mon, 26 Sep 2005 21:26:33 -0400 Received: from localhost ([127.0.0.1] helo=home.wh0rd.org) by smtp.gentoo.org with esmtp (Exim 4.43) id 1EK4Eo-00045h-2l for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:26:30 +0000 Received: (qmail 14264 invoked from network); 26 Sep 2005 21:23:38 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 26 Sep 2005 21:23:38 -0400 From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Date: Mon, 26 Sep 2005 21:27:11 -0400 User-Agent: KMail/1.8.2 References: <200508300009.27306.vapier@gentoo.org> <200509260102.27169.vapier@gentoo.org> <871x3cnziz.fsf@penguin.cs.ucla.edu> In-Reply-To: <871x3cnziz.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509262127.11135.vapier@gentoo.org> Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 01:43:03 -0000 On Monday 26 September 2005 01:55 am, Paul Eggert wrote: > Mike Frysinger writes: > >> But before we go off the deep end here, why exactly is this change a > >> good idea? > > > > the idea is to make the default output as intuitive as possible ... imo, > > defaulting to one's locale time format instead of a POSIX one makes more > > sense ... but i wouldnt be suprised if others felt differently :) > > I should emphasize again, though, that the current coreutils default > is not "a POSIX one" in the sense that you may be thinking. right, i was just referring to it as "a POSIX one" so as to easily differentiate between the current behavior and the new behavior i'm proposing of defaulting to one's locale style -mike From MAILER-DAEMON Mon Sep 26 22:31:43 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK5Fu-0005zt-Sw for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 22:31:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJwgW-00016M-T5 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJwgS-00012q-VT for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:34 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJwgR-00012b-SB for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:22:32 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EJwbW-00072j-MC for bug-coreutils@gnu.org; Mon, 26 Sep 2005 13:17:27 -0400 Received: (qmail invoked by alias); 26 Sep 2005 17:17:23 -0000 Received: from dialin-145-254-126-104.arcor-ip.net (EHLO thommy.koffer.de) [145.254.126.104] by mail.gmx.net (mp026) with SMTP; 26 Sep 2005 19:17:23 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id PAA02752 for ; Mon, 26 Sep 2005 15:52:49 +0200 Sender: root@thommy.koffer.de Message-ID: <4337FD31.35AE088B@gmx.de> Date: Mon, 26 Sep 2005 15:52:49 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: bug-coreutils@gnu.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Mailman-Approved-At: Mon, 26 Sep 2005 22:31:42 -0400 Subject: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2005 17:22:46 -0000 Hello folks, the `stat' command doesn't return an errorcode in case a given file couldn't be stated. The bug seems to be in the first calling parameter to `error()', which is always 0, so the global variable `G_fail' will never be set, in order to return something different than EXIT_SUCCESS - which is wrong. Greetings from Germany. CU Tom. (Thomas M.Ott) From MAILER-DAEMON Mon Sep 26 23:09:52 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK5qg-0007rw-H1 for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:09:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK5qa-0007ov-78 for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:09:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK5qS-0007lA-0Z for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:09:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK5qR-0007jR-Cf for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:09:27 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK5lN-0007hm-Uw for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:04:14 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id C07114B2E8; Mon, 26 Sep 2005 21:04:12 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id B313315B019; Mon, 26 Sep 2005 21:04:12 -0600 (MDT) Date: Mon, 26 Sep 2005 21:04:12 -0600 To: ThMO Message-ID: <20050927030412.GA22548@dementia.proulx.com> Mail-Followup-To: ThMO , bug-coreutils@gnu.org References: <4337FD31.35AE088B@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4337FD31.35AE088B@gmx.de> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: bug-coreutils@gnu.org Subject: Re: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bug-coreutils@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 03:09:40 -0000 ThMO wrote: > the `stat' command doesn't return an errorcode in case a given file > couldn't be stated. > The bug seems to be in the first calling parameter to `error()', which > is always 0, so the global variable `G_fail' will never be set, in > order to return something different than EXIT_SUCCESS - which is wrong. Thank you for taking the time to dig into this and report the bug. This is greatly appreciated. This bug is fixed in the latest test release. A new test release is in the works right now. But there have been quite a few changes recently and so it will take some time before it can be called stable. The next stable release will contain this fix. You might want to try the latest test release: ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.bz2 Or even the latest from cvs: http://savannah.gnu.org/cvs/?group=coreutils The CVS entry for the fix is: ---------------------------- revision 1.73 date: 2004-08-03 19:08:31 +0000; author: eggert; state: Exp; lines: +63 -68 (G_fail): Remove. (print_statfs): Print various gotta-be-nonnegative values using unsigned long int, not long int or int. (do_statfs, do_stat): Return a boolean success flag. (do_stat, main): Use bool for booleans. ---------------------------- Thanks again, Bob From MAILER-DAEMON Mon Sep 26 23:35:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK6G4-0008Pm-Pk for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:35:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK6G1-0008O8-7y for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:35:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK6Fw-0008LR-Cy for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:35:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK6Fv-0008K6-ML for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:35:47 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK6AQ-0000sV-DY for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:30:06 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 8A7B94B2E8 for ; Mon, 26 Sep 2005 21:30:05 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 8040E15B025; Mon, 26 Sep 2005 21:30:05 -0600 (MDT) Date: Mon, 26 Sep 2005 21:30:05 -0600 To: bug-coreutils@gnu.org Message-ID: <20050927033005.GC22548@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050927030412.GA22548@dementia.proulx.com> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 03:35:54 -0000 Bob Proulx wrote: > ThMO wrote: > > the `stat' command doesn't return an errorcode in case a given file > > couldn't be stated. I couldn't find a Changelog or NEWS entry for this since I am sure the bug was fixed as part of a general cleanup and not because it was recognized at the time as specifically a stat exit bug getting fixed. But perhaps I missed it. I seem to recall this getting reported more than once from users so it would be useful to record it specifically. Let me suggest the following for a NEWS entry in the "Bug fixes" section. stat now exits with status 1 upon failure. Or perhaps more verbosely: stat previously failed to detect errors and would exit with a status 0 success indication even if the FILE failed to exist. Now stat detects this error and exits with status 1 upon failure. Bob From MAILER-DAEMON Mon Sep 26 23:36:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK6GH-00006s-Mj for mharc-bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:36:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK6GD-0008VW-JD for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:36:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK6GA-0008U5-NT for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:36:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK6GA-0008K6-GK for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:36:02 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK5zE-0000U2-Qu for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:18:33 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 1ED1F4B2E8 for ; Mon, 26 Sep 2005 21:18:32 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 16C7215B024; Mon, 26 Sep 2005 21:18:32 -0600 (MDT) Date: Mon, 26 Sep 2005 21:18:32 -0600 To: bug-coreutils@gnu.org Message-ID: <20050927031832.GB22548@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org References: <87slvtk6qk.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87slvtk6qk.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Subject: Re: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 03:36:07 -0000 Paul Eggert wrote: > The recent changes involving adding better support for futimes, > fchmod, and fchown got me to thinking that these system calls aren't > easily accessible to shell scripts, which goes counter to a primary > original motivation for the shell -- namely, that it was a thin shell > around the operating system calls. Seems reasonable. I guess. However, I personally don't think of the shell as being a complete C programming layer and don't feel the need to expose every library and system call to it. But okay. (I feel that is more of the task of perl, python and ruby. :-) > To help counteract this for futimes, we can have "touch -" touch the > standard output, i.e., it can invoke futimes on the standard output > rather than utimes on the file named "-". This is pretty > straightforward so I installed the following patch. Making special cases such as "-" mean stdin or stdout always seemed like an ugly hack to me. It makes it more difficult to actually refer to real files named "-". My first memory of this is that 'tar' would make use of that special name. I don't know if that was the first use or not but that was where I first ran into it. I used that convention in some of my own programs. And later wished that I had not. It is really in-band control. Which always has problems telling the data from the control. I would prefer if "-" were not special but that instead an option were added such as --stdin and --stdout and those were used to access this special mode. This would be out-of-band control which avoids that problem. touch --reference /tmp --stdin touch --date '1 hour ago' --stdout That just seems to read better than: touch --reference /tmp - touch --date '1 hour ago' - One disadvantage of the --stdin/--stdout method is that one can't use a filename in a variable and have it select between. if [ $# -eq 0 ]; then filename=- else filename="$1" fi touch "$filename" But I can't think of a case where that would be useful. And I can't think of how to handle it for the problem case where the filename would be "-" either. Note that I don't feel strongly about it because files named "-" are unusual and unlikely to be a source of problems. I just don't like the special casing required which would not have been required previously. But it is certainly possible to contrive an example where backward compatibility would be broken. Bob From MAILER-DAEMON Tue Sep 27 00:12:21 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK6pG-0001lN-Vq for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:12:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK6pC-0001jY-Kw for bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:12:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK6p7-0001gU-DA for bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:12:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK6p7-0001g8-0x for bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:12:09 -0400 Received: from [216.148.227.85] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK6oV-00037J-Gw for bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:11:31 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (rwcrmhc12) with ESMTP id <2005092704112501400kuu5ee>; Tue, 27 Sep 2005 04:11:25 +0000 Message-ID: <4338C662.9030504@byu.net> Date: Mon, 26 Sep 2005 22:11:14 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Dr. David Alan Gilbert" References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> <20050926171740.GA8154@gallifrey> In-Reply-To: <20050926171740.GA8154@gallifrey> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: bug-coreutils@gnu.org, Jim Meyering Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 04:12:16 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Dr. David Alan Gilbert on 9/26/2005 11:17 AM: > >>>$ mkdir a b >>>$ ln -s $PWD/a sym >>>$ mv sym/ b >>>mv: cannot move `sym/' to `b/sym': Not a directory > > Nod. Perhaps the warning needs a warning that it can't be relied > on? No, POSIX requires rename("sym/", name) to move the directory, not the symlink, so the warning is accurate and should apply to all systems, whether or not their rename is conformant. You may also want to check what `type mv` prints, in case you have an alias in place that strips trailing slashes. - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDOMZh84KuGfSFAYARAsNCAJ474YiX73/7s2kWiy0lMycYsDK+rgCeNewk 5XM3GtBn5YbR0iHnMoiR95k= =/t4l -----END PGP SIGNATURE----- From MAILER-DAEMON Tue Sep 27 01:09:37 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK7ij-0002K0-4U for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:09:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK7iM-0002F8-S0 for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:09:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK7iE-00026r-UO for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:09:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK7i8-0001uN-7O for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:09:00 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK7K8-0005O3-T0 for bug-coreutils@gnu.org; Tue, 27 Sep 2005 00:44:13 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8R4i9405249; Mon, 26 Sep 2005 21:44:09 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EK7K4-0005zE-OM; Mon, 26 Sep 2005 21:44:08 -0700 To: Mike Frysinger References: <200508300009.27306.vapier@gentoo.org> <200509260102.27169.vapier@gentoo.org> <871x3cnziz.fsf@penguin.cs.ucla.edu> <200509262127.11135.vapier@gentoo.org> From: Paul Eggert Date: Mon, 26 Sep 2005 21:44:08 -0700 In-Reply-To: <200509262127.11135.vapier@gentoo.org> (Mike Frysinger's message of "Mon, 26 Sep 2005 21:27:11 -0400") Message-ID: <87ek7bjf1j.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 05:09:24 -0000 Mike Frysinger writes: > i was just referring to it as "a POSIX one" so as to easily > differentiate between the current behavior and the new behavior i'm proposing > of defaulting to one's locale style OK. One other possibility that comes to mind is (1) to modify --time-style='locale' so that, if the locale does not specify a time style (many don't), it behaves like --time-style='long-iso'; and (2) to make --time-style='locale' the default. This would overcome one objection to --time-style='locale', namely that it outputs English (which is annoying to some non-English readers) on non-English configurations that don't have proper translations for ls time formats. As I recall, that (along with the Emacs problem) was a motivation for the current default. But we'd still have to see how Emacs dired is doing in this area. Is that something you can look into? Have you tried using Emacs in locales that have really oddball time styles? Maybe you can systematically investigate Emacs dired with all the locales supported by Gentoo, in a directory where the 'ls -l' output exhibits each month name. From MAILER-DAEMON Tue Sep 27 01:40:11 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK8CG-0004DO-19 for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:40:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK8CD-0004AU-88 for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:40:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK8C9-00048t-Qp for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:40:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK8C8-00048J-TJ for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:40:01 -0400 Received: from [128.148.106.155] (helo=scorpio.services.brown.edu) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EK8AY-0007qw-3w for bug-coreutils@gnu.org; Tue, 27 Sep 2005 01:38:22 -0400 Received: from techhouse.brown.edu (techhouse.brown.edu [138.16.60.2]) by scorpio.services.brown.edu (Switch-3.1.7/Switch-3.1.7/) with ESMTP id j8R5cBC2013783; Tue, 27 Sep 2005 01:38:11 -0400 (EDT) Received: by techhouse.brown.edu (Postfix, from userid 580) id A5A78CC001; Tue, 27 Sep 2005 01:38:10 -0400 (EDT) Date: Tue, 27 Sep 2005 01:38:10 -0400 To: Bob Proulx , bug-coreutils@gnu.org Message-ID: <20050927053810.GA25444@techhouse.org> References: <87slvtk6qk.fsf@penguin.cs.ucla.edu> <20050927031832.GB22548@dementia.proulx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050927031832.GB22548@dementia.proulx.com> User-Agent: Mutt/1.5.9i From: dfeuer@techhouse.brown.edu (David Feuer) X-Brown-Proofpoint: Not Infected X-Proofpoint-Spam-Reason: safe Cc: Subject: Re: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 05:40:06 -0000 On Mon, Sep 26, 2005 at 09:18:32PM -0600, Bob Proulx wrote: > I would prefer if "-" were not special but that instead an option were > added such as --stdin and --stdout and those were used to access this > special mode. This would be out-of-band control which avoids that > problem. Much better would be --fd=0 --fd=1 --fd=2 etc. That allows full generality. Something like that could be very nice for tee too. (note: it's 1:37 here, so I could be talking nonsense). David From MAILER-DAEMON Tue Sep 27 02:44:42 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EK9Cj-0000me-9Q for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 02:44:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EK9Cb-0000jn-QC for bug-coreutils@gnu.org; Tue, 27 Sep 2005 02:44:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EK9CT-0000iM-19 for bug-coreutils@gnu.org; Tue, 27 Sep 2005 02:44:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EK9CS-0000X0-CP for bug-coreutils@gnu.org; Tue, 27 Sep 2005 02:44:24 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EK94f-0003I8-6J for bug-coreutils@gnu.org; Tue, 27 Sep 2005 02:36:21 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8R6aK410376 for ; Mon, 26 Sep 2005 23:36:20 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EK94d-0004MT-VI for bug-coreutils@gnu.org; Mon, 26 Sep 2005 23:36:19 -0700 To: bug-coreutils@gnu.org References: <87slvtk6qk.fsf@penguin.cs.ucla.edu> <20050927031832.GB22548@dementia.proulx.com> From: Paul Eggert Date: Mon, 26 Sep 2005 23:36:19 -0700 In-Reply-To: <20050927031832.GB22548@dementia.proulx.com> (Bob Proulx's message of "Mon, 26 Sep 2005 21:18:32 -0600") Message-ID: <87irwnhva4.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: "touch -" touching standard output X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 06:44:37 -0000 bob@proulx.com (Bob Proulx) writes: > Making special cases such as "-" mean stdin or stdout always seemed > like an ugly hack to me. It makes it more difficult to actually refer > to real files named "-". True, though that horse left the barn around 1975 and hasn't been seen since. Here's a fun example. The following shell command works even with older coreutils (e.g., Debian stable), and it updates /var/tmp's time stamp on my host: touch /dev/stdout 1< /var/tmp It's not clear what effect this command will have on various other hosts, though. The idea of --fd=0 --fd=1 would also work, but would be harder to parse and explain -- e.g., people might want to interleave those options with file names, which runs into getopt and documentation issues. From MAILER-DAEMON Tue Sep 27 06:22:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKCab-0002m3-Bw for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 06:21:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKCaI-0002c7-MU for bug-coreutils@gnu.org; Tue, 27 Sep 2005 06:21:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKCZO-0002Br-KE for bug-coreutils@gnu.org; Tue, 27 Sep 2005 06:20:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKCZ0-0000xP-Li for bug-coreutils@gnu.org; Tue, 27 Sep 2005 06:19:54 -0400 Received: from [195.135.220.2] (helo=mx1.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EKCHs-0002Na-2N for bug-coreutils@gnu.org; Tue, 27 Sep 2005 06:02:12 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 4D2D5ED3C; Tue, 27 Sep 2005 12:02:05 +0200 (CEST) From: Andreas Schwab To: Paul Eggert References: <200508300009.27306.vapier@gentoo.org> <200509260102.27169.vapier@gentoo.org> <871x3cnziz.fsf@penguin.cs.ucla.edu> <200509262127.11135.vapier@gentoo.org> <87ek7bjf1j.fsf@penguin.cs.ucla.edu> X-Yow: .. I wonder if I ought to tell them about my PREVIOUS LIFE as a COMPLETE STRANGER? Date: Tue, 27 Sep 2005 12:02:04 +0200 In-Reply-To: <87ek7bjf1j.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Mon, 26 Sep 2005 21:44:08 -0700") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org, Mike Frysinger Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 10:21:29 -0000 Paul Eggert writes: > But we'd still have to see how Emacs dired is doing in this area. Is > that something you can look into? Have you tried using Emacs in > locales that have really oddball time styles? Emacs can use --dired now, so this should not be an issue. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From MAILER-DAEMON Tue Sep 27 16:44:58 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKMJt-00068T-Nb for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 16:44:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKMJm-000656-VD for bug-coreutils@gnu.org; Tue, 27 Sep 2005 16:44:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKMJc-0005yt-EU for bug-coreutils@gnu.org; Tue, 27 Sep 2005 16:44:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKMJc-0005yB-8R for bug-coreutils@gnu.org; Tue, 27 Sep 2005 16:44:40 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKMIy-0005ZM-OG for bug-coreutils@gnu.org; Tue, 27 Sep 2005 16:44:01 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8RKhx403991; Tue, 27 Sep 2005 13:43:59 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKMIx-0001Tw-7c; Tue, 27 Sep 2005 13:43:59 -0700 To: bug-coreutils@gnu.org References: <200508300009.27306.vapier@gentoo.org> <200509260102.27169.vapier@gentoo.org> <871x3cnziz.fsf@penguin.cs.ucla.edu> <200509262127.11135.vapier@gentoo.org> <87ek7bjf1j.fsf@penguin.cs.ucla.edu> From: Paul Eggert Date: Tue, 27 Sep 2005 13:43:59 -0700 In-Reply-To: (Andreas Schwab's message of "Tue, 27 Sep 2005 12:02:04 +0200") Message-ID: <87r7bas0kw.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mike Frysinger Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 20:44:56 -0000 Andreas Schwab writes: > Emacs can use --dired now, so this should not be an issue. OK, thanks. I just now checked, and if I understand it aright this started happening with Emacs 21.3 (released March 2003). Can we safely assume that everyone in non-POSIX locales with oddball time stamp formats and who wants to use recent coreutils is also using Emacs 21.3 or later? It sounds a bit risky, but perhaps it would be OK. (After the next coreutils release, that is.) If we can assume Emacs works, then that removes the last major worry I had about 'locale' time stamp format being the default. To recapitulate the worries, this was: * Poorly configured hosts would generate English time stamps in non-English locales (this would be fixed by having --time-stamp='locale' default to long-iso formats in such locales -- a fix that is not done yet). * Time stamps were not all the same width, leading to jagged columns. (Fixed in GNU/Linux by having the locales done right; other hosts like Solaris will just have jagged columns, I guess. If this turns into a real problem we can have ls autoadjust the widths as it already does for several other columns.) * Emacs got confused. Mike, what do you think about the following patch for Gentoo, in place of what Gentoo is doing currently? It implements the suggestion I have in mind. This is not installed in coreutils: it's just a proposal. 2005-09-27 Paul Eggert * NEWS: ls now defaults to --time-style="locale", but this style now behaves like posix-long-iso if your locale appears to be messed up. * doc/coreutils.texi (Formatting file timestamps): Document that --time-style="locale" is now the default. Update advice for Emacs 21.3 and later. * src/ls.c (decode_switches): Implement the above. Index: NEWS =================================================================== RCS file: /fetish/cu/NEWS,v retrieving revision 1.313 diff -p -u -r1.313 NEWS --- NEWS 25 Sep 2005 06:07:48 -0000 1.313 +++ NEWS 27 Sep 2005 20:38:29 -0000 @@ -1,5 +1,11 @@ GNU coreutils NEWS -*- outline -*- +** ls now defaults to --time-style="locale" rather than + --time-style="posix-long-iso". However, --time-style="locale" now + behaves like --time-style="posix-long-iso" if your locale settings + appear to be messed up. This change attempts to have the default be + the best of both worlds. + * Major changes in release 5.3.1-cvs (2005-??-??) [unstable] ** Bring back support for `head -NUM', `tail -NUM', etc. even when Index: doc/coreutils.texi =================================================================== RCS file: /fetish/cu/doc/coreutils.texi,v retrieving revision 1.285 diff -p -u -r1.285 coreutils.texi --- doc/coreutils.texi 25 Sep 2005 06:08:17 -0000 1.285 +++ doc/coreutils.texi 27 Sep 2005 20:38:32 -0000 @@ -6047,7 +6047,7 @@ and might generate timestamps like @samp @vindex LC_TIME List @acronym{POSIX}-locale timestamps if the @env{LC_TIME} locale category is @acronym{POSIX}, @var{style} timestamps otherwise. For -example, the default style, which is @samp{posix-long-iso}, lists +example, the @samp{posix-long-iso} style lists timestamps like @samp{Mar 30@ @ 2002} and @samp{Mar 30 23:45} when in the @acronym{POSIX} locale, and like @samp{2002-03-30 23:45} otherwise. @end table @@ -6056,10 +6056,11 @@ the @acronym{POSIX} locale, and like @sa @vindex TIME_STYLE You can specify the default value of the @option{--time-style} option with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set -the default style is @samp{posix-long-iso}. @acronym{GNU} Emacs 21 and -later can parse @acronym{ISO} dates, but older Emacs versions do not, so if -you are using an older version of Emacs and specify a non-@acronym{POSIX} -locale, you may need to set @samp{TIME_STYLE="locale"}. +the default style is @samp{locale}. @acronym{GNU} Emacs 21.3 and +later use the @option{--dired} option and therefore can parse any date +format, but if you are using Emacs 21.1 or 21.2 and specify a +non-@acronym{POSIX} locale you may need to set +@samp{TIME_STYLE="posix-long-iso"}. To avoid certain denial-of-service attacks, timestamps that would be longer than 1000 bytes may be treated as errors. Index: src/ls.c =================================================================== RCS file: /fetish/cu/src/ls.c,v retrieving revision 1.399 diff -p -u -r1.399 ls.c --- src/ls.c 16 Sep 2005 07:50:33 -0000 1.399 +++ src/ls.c 27 Sep 2005 20:38:33 -0000 @@ -1823,7 +1823,7 @@ decode_switches (int argc, char **argv) if (! style) if (! (style = getenv ("TIME_STYLE"))) - style = "posix-long-iso"; + style = "locale"; while (strncmp (style, posix_prefix, sizeof posix_prefix - 1) == 0) { @@ -1859,6 +1859,7 @@ decode_switches (int argc, char **argv) break; case long_iso_time_style: + case_long_iso_time_style: long_time_format[0] = long_time_format[1] = "%Y-%m-%d %H:%M"; break; @@ -1870,10 +1871,17 @@ decode_switches (int argc, char **argv) case locale_time_style: if (hard_locale (LC_TIME)) { + /* Ensure that the locale has translations for both + formats. If not, fall back on long-iso format. */ int i; for (i = 0; i < 2; i++) - long_time_format[i] = - dcgettext (NULL, long_time_format[i], LC_TIME); + { + char const *locale_format = + dcgettext (NULL, long_time_format[i], LC_TIME); + if (locale_format == long_time_format[i]) + goto case_long_iso_time_style; + long_time_format[i] = locale_format; + } } } } From MAILER-DAEMON Tue Sep 27 22:17:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKRVr-0001Yn-5O for mharc-bug-coreutils@gnu.org; Tue, 27 Sep 2005 22:17:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKRVq-0001Yi-1R for bug-coreutils@gnu.org; Tue, 27 Sep 2005 22:17:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKRVo-0001Xx-FP for bug-coreutils@gnu.org; Tue, 27 Sep 2005 22:17:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKRVo-0001XV-BE for bug-coreutils@gnu.org; Tue, 27 Sep 2005 22:17:36 -0400 Received: from [134.68.220.30] (helo=smtp.gentoo.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EKRUU-0003VM-CP for bug-coreutils@gnu.org; Tue, 27 Sep 2005 22:16:14 -0400 Received: from localhost ([127.0.0.1] helo=home.wh0rd.org) by smtp.gentoo.org with esmtp (Exim 4.43) id 1EKRUS-0001Hi-Ag for bug-coreutils@gnu.org; Wed, 28 Sep 2005 02:16:12 +0000 Received: (qmail 31977 invoked from network); 27 Sep 2005 22:13:00 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 27 Sep 2005 22:13:00 -0400 From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Date: Tue, 27 Sep 2005 22:16:57 -0400 User-Agent: KMail/1.8.2 References: <200508300009.27306.vapier@gentoo.org> <87r7bas0kw.fsf@penguin.cs.ucla.edu> In-Reply-To: <87r7bas0kw.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509272216.57173.vapier@gentoo.org> Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 02:17:38 -0000 On Tuesday 27 September 2005 04:43 pm, Paul Eggert wrote: > Mike, what do you think about the following patch for Gentoo, in place > of what Gentoo is doing currently? It implements the suggestion I > have in mind. This is not installed in coreutils: it's just a > proposal. looks good to me ... too bad you cant jump to case labels ;) you want me to give it a spin into the current Gentoo patchset for coreutils-5.3.0 ? -mike From MAILER-DAEMON Wed Sep 28 01:06:51 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKU9b-0002TK-Hs for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 01:06:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKP92-0000lE-H4 for bug-coreutils@gnu.org; Tue, 27 Sep 2005 19:45:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKP90-0000ki-PB for bug-coreutils@gnu.org; Tue, 27 Sep 2005 19:45:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKP90-0000kM-CF for bug-coreutils@gnu.org; Tue, 27 Sep 2005 19:45:54 -0400 Received: from [72.14.204.192] (helo=qproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKP8r-0002by-2W for bug-coreutils@gnu.org; Tue, 27 Sep 2005 19:45:45 -0400 Received: by qproxy.gmail.com with SMTP id p36so626851qba for ; Tue, 27 Sep 2005 16:45:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=f/MdJk3jXbn+mcc+7XapSYtAhCTsstQlsE0ov5drAHWxJbvB2l0fcAXqfhEl/gF07ttwKkhilMXgve9EHqWk3mdaGGNSJOfF2eoQbnAg1HvpcSmb0kQquQv/UUtks3ifsssICpNl/9rP2MxIE0Tmt4RN68pgHN59tY/+4kKzg9g= Received: by 10.65.100.12 with SMTP id c12mr814970qbm; Tue, 27 Sep 2005 16:45:43 -0700 (PDT) Received: by 10.65.148.6 with HTTP; Tue, 27 Sep 2005 16:45:43 -0700 (PDT) Message-ID: <8af1da5905092716457f4b6dca@mail.gmail.com> Date: Tue, 27 Sep 2005 16:45:43 -0700 From: Jungshyh Hwang To: bug-coreutils@gnu.org MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 28 Sep 2005 01:06:50 -0400 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: UNIX comm command does not work with underscore _ X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jungshyh Hwang List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 23:45:58 -0000 Hi: I am using /sr/bin/comm executable size 12956 byte /usr/bin/comm: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), fo= r GNU /Linux 2.2.5, dynamically linked (uses shared libs), stripped I have a cronjob works on solaris platform using the comm command. When application move to Linux machine. The cronjob output become incorrect= . After debugging I come up with a simple testcase with UNIX comm command on Linux platform does not handle undercore character. On solaris machine it works with =3D> $ comm -23 openuser_target_gsiap_test2 aitap_it_sec_user_audit_gsiap_test2 DBHAVSAR On Linux it fail with $ comm -23 openuser_target_gsiap_test2 aitap_it_sec_user_audit_gsiap_test2 DBHAVSAR DBL_AML_METRICS - File openuser_target_gsiap_test2 content =3D> DBHAVSAR DBL_AML_METRICS - aitap_it_sec_user_audit_gsiap_test2 content =3D> DBLUM DBL_AML_METRICS - Can you please see whether you can come out with a workaround or find a new version of comm or a new switch ...etc. Thanks, Jungshyh Hwang (O) 650 506-9147 From MAILER-DAEMON Wed Sep 28 01:12:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKUEp-00041Z-88 for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 01:12:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKUEo-00041A-45 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 01:12:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKUEm-000400-8c for bug-coreutils@gnu.org; Wed, 28 Sep 2005 01:12:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKUE2-0003dR-TN for bug-coreutils@gnu.org; Wed, 28 Sep 2005 01:11:26 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKTse-0004cV-Si for bug-coreutils@gnu.org; Wed, 28 Sep 2005 00:49:21 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8S4nI404275; Tue, 27 Sep 2005 21:49:18 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKTsc-0001e4-OE; Tue, 27 Sep 2005 21:49:18 -0700 To: Mike Frysinger References: <200508300009.27306.vapier@gentoo.org> <87r7bas0kw.fsf@penguin.cs.ucla.edu> <200509272216.57173.vapier@gentoo.org> From: Paul Eggert Date: Tue, 27 Sep 2005 21:49:18 -0700 In-Reply-To: <200509272216.57173.vapier@gentoo.org> (Mike Frysinger's message of "Tue, 27 Sep 2005 22:16:57 -0400") Message-ID: <871x39bxv5.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: tweaking default `ls -l` output to use locale before posix X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 05:12:14 -0000 Mike Frysinger writes: > you want me to give it a spin into the current Gentoo patchset for > coreutils-5.3.0 ? Yes, please, if that's not too much trouble. The idea here is to get some real-user experience with --time-style="locale" defaulting to long-iso if one's locale settings are messed up. Maybe Gentoo users never mess up their locales, so they'll never notice any difference; but that'll be a data point too. Let's put it this way: if the patch causes problems with Gentoo users then we can be pretty sure that it won't fly elsewhere and we should fix it before committing to it. > too bad you cant jump to case labels ;) Yes, well, my first version of the code looked like this: case long_iso_time_style: long_iso_time_style: with a "goto long_iso_time_style;" elsewhere. That's perfectly valid and portable C. But I decided it was too weird even for me. From MAILER-DAEMON Wed Sep 28 05:28:22 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKYEa-0007al-0J for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:28:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKYEM-0007XQ-J2 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:28:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKY3H-0006gD-Gg for bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:16:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKXLq-0004o7-W8 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 04:31:43 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKXK3-0002Lp-AL for bug-coreutils@gnu.org; Wed, 28 Sep 2005 04:29:51 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8S8TZ417221; Wed, 28 Sep 2005 01:29:35 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKXJn-0001hE-C2; Wed, 28 Sep 2005 01:29:35 -0700 To: Jungshyh Hwang References: <8af1da5905092716457f4b6dca@mail.gmail.com> From: Paul Eggert Date: Wed, 28 Sep 2005 01:29:35 -0700 In-Reply-To: <8af1da5905092716457f4b6dca@mail.gmail.com> (Jungshyh Hwang's message of "Tue, 27 Sep 2005 16:45:43 -0700") Message-ID: <87slvpa93k.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: UNIX comm command does not work with underscore _ X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 09:28:04 -0000 That looks like a locale issue. Try setting LC_ALL=C in the environment. From MAILER-DAEMON Wed Sep 28 05:31:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKYHa-0000gW-Df for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:31:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKYGG-0008UG-Cm for bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:30:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKY4b-0006jM-Ft for bug-coreutils@gnu.org; Wed, 28 Sep 2005 05:18:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKXLq-0004o7-KY for bug-coreutils@gnu.org; Wed, 28 Sep 2005 04:31:42 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKXK8-0002MB-7B for bug-coreutils@gnu.org; Wed, 28 Sep 2005 04:29:56 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 5C2C4E37; Wed, 28 Sep 2005 10:29:53 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Date: Wed, 28 Sep 2005 10:29:53 +0200 Message-ID: <87slvpk326.fsf@rho.meyering.net> Lines: 11 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: infloop in `make check' on FreeBSD 5.0: due to /bin/sh? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 09:31:18 -0000 FYI: I've just added this warning to coreutils' README file: *********************** FreeBSD 5.0 `make test' infinite loop with /bin/sh ----------------------- When building and running `make test' on a FreeBSD 5.0 system, expect the tests/install/trap test to get stuck in an infinite loop. That appears to be due to a bug in /bin/sh. When you change the first line of the tests/install/trap script to be e.g., #!/usr/local/bin/bash, the test completes normally. From MAILER-DAEMON Wed Sep 28 09:56:05 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKcPj-00011E-GT for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 09:56:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKcPf-0000zY-VS for bug-coreutils@gnu.org; Wed, 28 Sep 2005 09:56:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKcKH-00085n-RN for bug-coreutils@gnu.org; Wed, 28 Sep 2005 09:50:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKcKB-0007ut-O1 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 09:50:20 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKcAa-0005n1-EH for bug-coreutils@gnu.org; Wed, 28 Sep 2005 09:40:24 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 444D11475; Wed, 28 Sep 2005 15:40:23 +0200 (CEST) From: Jim Meyering To: Eric Blake In-Reply-To: <4338C662.9030504@byu.net> (Eric Blake's message of "Mon, 26 Sep 2005 22:11:14 -0600") References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> <20050926171740.GA8154@gallifrey> <4338C662.9030504@byu.net> Date: Wed, 28 Sep 2005 15:40:23 +0200 Message-ID: <87vf0lia48.fsf@rho.meyering.net> Lines: 26 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 13:56:01 -0000 Eric Blake wrote: > According to Dr. David Alan Gilbert on 9/26/2005 11:17 AM: >> >>>>$ mkdir a b >>>>$ ln -s $PWD/a sym >>>>$ mv sym/ b >>>>mv: cannot move `sym/' to `b/sym': Not a directory >> >> Nod. Perhaps the warning needs a warning that it can't be relied >> on? > > No, POSIX requires rename("sym/", name) to move the directory, not the > symlink, so the warning is accurate and should apply to all systems, > whether or not their rename is conformant. You may also want to check > what `type mv` prints, in case you have an alias in place that strips > trailing slashes. As you can imagine, I find the POSIX-required behavior to be senseless. The above behavior of non-POSIX rename, seen on Linux-2.6.x, is fine. Now that Linux/glibc provides a sane rename function, I'm tempted to make mv work in the above manner on all systems rather than allowing the crazy move-pointed-to-directory behavior on systems with a technically-conforming rename. The wrapper will incur the expense of a syscall or two on losing systems when the first argument ends with `/'. From MAILER-DAEMON Wed Sep 28 10:18:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKclN-00049V-Tq for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 10:18:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKclE-000453-VY for bug-coreutils@gnu.org; Wed, 28 Sep 2005 10:18:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKcl3-0003zE-V3 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 10:18:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKcl3-0003tr-Ke for bug-coreutils@gnu.org; Wed, 28 Sep 2005 10:18:05 -0400 Received: from [204.127.198.43] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKch5-0001Qw-Mm for bug-coreutils@gnu.org; Wed, 28 Sep 2005 10:14:01 -0400 Received: from 204.127.197.119 (rmailcenter77.comcast.net[204.127.197.177]) by comcast.net (rwcrmhc12) with SMTP id <2005092814135001400kntm5e>; Wed, 28 Sep 2005 14:13:50 +0000 Received: from [128.170.36.44] by 204.127.197.119; Wed, 28 Sep 2005 14:13:50 +0000 From: ericblake@comcast.net (Eric Blake) To: Jim Meyering Date: Wed, 28 Sep 2005 14:13:50 +0000 Message-Id: <092820051413.25843.433AA51D000CFED2000064F322007510900A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 14:18:22 -0000 > > As you can imagine, I find the POSIX-required behavior to be senseless. > The above behavior of non-POSIX rename, seen on Linux-2.6.x, is fine. > Now that Linux/glibc provides a sane rename function, I'm tempted > to make mv work in the above manner on all systems rather than allowing > the crazy move-pointed-to-directory behavior on systems with a > technically-conforming rename. > > The wrapper will incur the expense of a syscall or two on losing systems > when the first argument ends with `/'. If you do that, you need to make sure POSIXLY_CORRECT still gets the POSIX behavior of move-pointed-to-directory. But wasn't this the reason that --strip-trailing-slashes was created as an option? That way, a user can do alias mv='mv --strip-trailing-slashes' and get the sane behavior of always moving the symlink, not the pointed-to-directory, regardless of whether rename() is conformant or not, and regardless of whether their shell's tab-completion puts slashes on symlinks-to-directories. Meanwhile, since you think that the POSIX definition of rename() is insane, try filing an aardvark to allow an implementation-defined choice between moving the symlink/moving the directory, rather than the current mandated semantics of moving the directory. That way, Linux 2.6.x would still be able to comply to POSIX with what you term to be saner semantics (personally, I like the POSIX-mandated semantics, as it provides a consistent way to choose between operating on the symlink vs. operating on what it points to by the presence of the trailing slash, and it is not just rename() that is affected by POSIX semantics). Or you could file an aardvark on mv(1) to allow an implementation to always strip trailing slashes before calling rename(). -- Eric Blake From MAILER-DAEMON Wed Sep 28 13:40:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKfuK-0006rj-TP for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 13:39:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKfu1-0006ix-Gi for bug-coreutils@gnu.org; Wed, 28 Sep 2005 13:39:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKfts-0006dN-1q for bug-coreutils@gnu.org; Wed, 28 Sep 2005 13:39:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKfto-0006ZJ-Vl for bug-coreutils@gnu.org; Wed, 28 Sep 2005 13:39:21 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKfoj-0000z3-Bg for bug-coreutils@gnu.org; Wed, 28 Sep 2005 13:34:05 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SHY0414068; Wed, 28 Sep 2005 10:34:00 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKfoe-0003za-Sc; Wed, 28 Sep 2005 10:34:00 -0700 To: Jim Meyering References: <87slvpk326.fsf@rho.meyering.net> From: Paul Eggert Date: Wed, 28 Sep 2005 10:34:00 -0700 In-Reply-To: <87slvpk326.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 28 Sep 2005 10:29:53 +0200") Message-ID: <87wtl1umev.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: infloop in `make check' on FreeBSD 5.0: due to /bin/sh? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 17:39:42 -0000 Jim Meyering writes: > FYI: I've just added this warning to coreutils' README file: > *********************** > FreeBSD 5.0 `make test' infinite loop with /bin/sh > ----------------------- > > When building and running `make test' on a FreeBSD 5.0 system, > expect the tests/install/trap test to get stuck in an infinite > loop. That appears to be due to a bug in /bin/sh. I didn't see the original bug report, but if that /bin/sh bug is what I think it might be, the following patch would work around the problem. Can this be tried out on FreeBSD 5.0? 2005-09-28 Paul Eggert * tests/install/trap: Work around a bug in FreeBSD 5.0. --- trap.~1.3.~ 2005-04-20 17:30:35.000000000 -0700 +++ trap 2005-09-28 10:32:31.000000000 -0700 @@ -23,10 +23,13 @@ fi fail=0 -# ash doesn't support "trap '' CHLD"; it knows only signal numbers. -sig=`$pwd/../../src/kill -l CHLD 2>/dev/null` && trap '' $sig +# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. +( + # ash doesn't support "trap '' CHLD"; it knows only signal numbers. + sig=`$pwd/../../src/kill -l CHLD 2>/dev/null` && trap '' $sig -# Before 2004-04-21, install would infloop, in the `while (wait...' loop: -ginstall -s $pwd/../../src/ginstall$EXEEXT . + # Before 2004-04-21, install would infloop, in the `while (wait...' loop: + exec ginstall -s $pwd/../../src/ginstall$EXEEXT . +) (exit $fail); exit $fail From MAILER-DAEMON Wed Sep 28 14:34:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKglX-0006Jj-W8 for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKglR-0006Fx-Rm for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKglM-0006C9-2P for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKglL-00069W-3U for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:39 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKgj3-00056k-Hs for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:32:17 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 4B16F6AC9; Wed, 28 Sep 2005 20:32:06 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87wtl1umev.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Wed, 28 Sep 2005 10:34:00 -0700") References: <87slvpk326.fsf@rho.meyering.net> <87wtl1umev.fsf@penguin.cs.ucla.edu> Date: Wed, 28 Sep 2005 20:32:06 +0200 Message-ID: <87mzlxgi1l.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, "Nelson H. F. Beebe" Subject: Re: infloop in `make check' on FreeBSD 5.0: due to /bin/sh? X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 18:34:49 -0000 Paul Eggert wrote: > Jim Meyering writes: > >> FYI: I've just added this warning to coreutils' README file: >> *********************** >> FreeBSD 5.0 `make test' infinite loop with /bin/sh >> ----------------------- >> >> When building and running `make test' on a FreeBSD 5.0 system, >> expect the tests/install/trap test to get stuck in an infinite >> loop. That appears to be due to a bug in /bin/sh. > > I didn't see the original bug report, but if that /bin/sh bug is what Nelson Beebe reported it privately. > I think it might be, the following patch would work around the > problem. Can this be tried out on FreeBSD 5.0? That works, so I've applied it and reverted the README change. Thanks. > 2005-09-28 Paul Eggert > > * tests/install/trap: Work around a bug in FreeBSD 5.0. From MAILER-DAEMON Wed Sep 28 14:35:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKgli-0006Nk-3I for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:35:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKglc-0006La-IF for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKglT-0006HG-2o for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKglS-00069W-8V for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:34:46 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKgdM-0004sX-Vf for bug-coreutils@gnu.org; Wed, 28 Sep 2005 14:26:25 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SIQN419646; Wed, 28 Sep 2005 11:26:23 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKgdL-00044p-QQ; Wed, 28 Sep 2005 11:26:23 -0700 To: bug-coreutils@gnu.org References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> <20050926171740.GA8154@gallifrey> <4338C662.9030504@byu.net> <87vf0lia48.fsf@rho.meyering.net> From: Paul Eggert Date: Wed, 28 Sep 2005 11:26:23 -0700 In-Reply-To: <87vf0lia48.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 28 Sep 2005 15:40:23 +0200") Message-ID: <87slvpujzk.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 18:35:00 -0000 Jim Meyering writes: > As you can imagine, I find the POSIX-required behavior to be senseless. Two things. First, I recall that you preferred the non-POSIX behavior because of file name completion issues. But because we agitated about this a while ago, Bash now does a better job with file name completion. For example, given this: mkdir dir ln -s dir symlink If I type "mv sym[TAB]", where [TAB] stands for a tab character, the screen then looks like this: mv symlink If I type another [TAB] it then looks like this: mv symlink/ so I'm given a signal from Bash that I have a symlink to a directory, and that it matters whether there's a trailing slash. In the old days this didn't happen, the intermediate step was missing, and so there was more of an argument that "mv symlink/ target" should ignore the slash. Nowadays, though, isn't that argument weaker? Second, I just read the POSIX spec and it seems to be a bit buggy . The rationale says "Renaming dot or dot-dot is prohibited" but I can't see anything to that effect in the text itself. Furthermore, POSIX says that a pathname like "abc/" must be resolved as if it were "abc/." (see ) so arguably rename("abc/", "def") must be handled like rename("abc/.", "def") and if renaming dot or dot-dot is prohibited (which I think it must be, even if it's omitted inadvertently from the standard) then this must fail. There's a similar issue with "rmdir symlink/". It's not clear that rmdir ("symlink/") should succeed, because pathname resolution indicates that it should be treated like rmdir ("symlink/.") and this clearly must fail. Clearly it's a messy area. My kneejerk reaction is that I might prefer it if "mv symlink/ foo" and "rmdir symlink/" always failed, if only because in a confusing situation like this it's often better to use the Hippocratic rule: first, do no harm. It would be easy to implement that rule: it wouldn't require any system calls at all, since we could simply reject all file names with trailing slashes. From MAILER-DAEMON Wed Sep 28 15:42:30 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKhp0-0001NH-47 for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 15:42:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKhoy-0001MW-5r for bug-coreutils@gnu.org; Wed, 28 Sep 2005 15:42:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKhop-0001IB-9z for bug-coreutils@gnu.org; Wed, 28 Sep 2005 15:42:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKhoo-0001Gs-EO for bug-coreutils@gnu.org; Wed, 28 Sep 2005 15:42:18 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EKhle-0001L3-Ck for bug-coreutils@gnu.org; Wed, 28 Sep 2005 15:39:02 -0400 Received: (qmail invoked by alias); 28 Sep 2005 19:38:57 -0000 Received: from dialin-145-254-244-139.arcor-ip.net (EHLO thommy.koffer.de) [145.254.244.139] by mail.gmx.net (mp018) with SMTP; 28 Sep 2005 21:38:57 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id VAA02113; Wed, 28 Sep 2005 21:37:19 +0200 Sender: root@thommy.koffer.de Message-ID: <433AF0EF.3499CE39@gmx.de> Date: Wed, 28 Sep 2005 21:37:19 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: bug-coreutils@gnu.org References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 Cc: Bob Proulx Subject: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 19:42:28 -0000 Hello Bob and others listening, > > the `stat' command doesn't return an errorcode in case a given file > > couldn't be stated. > > The bug seems to be in the first calling parameter to `error()', which > > is always 0, so the global variable `G_fail' will never be set, in > > order to return something different than EXIT_SUCCESS - which is wrong. > > Thank you for taking the time to dig into this and report the bug. > This is greatly appreciated. This bug is fixed in the latest test > release. A new test release is in the works right now. But there > have been quite a few changes recently and so it will take some time > before it can be called stable. The next stable release will contain > this fix. > > You might want to try the latest test release: > ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz > ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.bz2 I took the time to test the above package - and I have to say several things about this test-release: · even though the C compiler might be able to deal with 64-bit integer values, this must *not* be the case with the C pre-processor: #define ULLONG_MAX 18446744073709551615ULL the C compiler (gcc v2.7.2.1) *is* able to deal with that value, but the cpp can't - instead I had to hand-fix this kind of stuff with: #define LONGEST_MODIFIER "ll" inside config.h and I had to modify lib/fts.c and src/system.h: I had to enclose the definition of the symbol LONGEST_MODIFIER by #ifndef LONGEST_MODIFIER ... #endif constructs in order to compile correctly but the question really is - is it necessary for a system, which works with 32-bit integers *and* which is able to handle files up to 2GB only? -> definitely no, as it just wastes both space and running time · lib/getdate.y: I'm using bison v1.28 - and for me it's unacceptable, that this grammar can't be processed corrrectly with this older version, as there is abso= lutely no need in it, that bison is working on this grammar - instead it should also be processed by stock berkeley yacc, which it doesn't interestingly there is even in v1.28 a method of setting parameters both for yylex() and yyparse() - so this is very surprising and it's even more surprising if I look at 1.7 meg big, fat configure script, which could handle exactly such things... just think about that - even other people are nowadays using beta-software in order to handle their grammars and scanners - the lastest example is libraptor v1.4.7, which uses flex v2.5.31, which is flagged beta *and* uses a specially hacked debian-version of this lexer, while there is abso= lutely no need to do so -> this is a very bad practise - IMHO BTW, is anyone able to guarantee me, that bison v2.0 has not even one problem with processing older (and oldest - I'm using software packages dated in the early 80's) grammar files? · src/su.c: it would be nice if there would be some configure flags for the 3 compile- time symbols for setting up the logging activity for the su command instead I had to, as usually, hand-fix this file, just to get some loggings of some su activity, which is boring... · --disable-nls: IMHO there is no need, if I decide to configure *wihtout* NLS support, which I usually do, to setup a specific locale, since the one and only locale is the C locale in this case (and iso-8859-1 in my case) - although YMMV at this point · man/dd.1: the man-page should *always* reflect the various options, for which a command was configured for - only while removing *all* pre-processed man-pages (as I always do for *all* kinds of things, which could be rege= nerated), will reflect the man-page for the dd command the command itself. since there are two flags, which aren't supported by my older system... -> in that case would it be more elegant, if the help() for the dd command would #ifdef out those unsupported printing calls instead of doing it during running-time, right? ;-) · invoking the various commands through info: the correct way to invoke say the info-pages for dd is: info coreutils dd as there is absolutely no need to pollute the info/dir file with lengthy sub-menu options just for looking up a specific command, as the primary source for every *real* unix-user is the man-page - and only if the de= scription within the man-page are not as clear as it should be, will the info reader be started - the man-page only says: info dd · factor: it's increddible - your factor command is *not* able to factorize negative values - folks, even my several years old factor command taken from some very old BSD games-package *is* able to do that! only this command knowns nothing about the --help switch - but then again, this could easily be done using a very small shell wrapper script · pinky: what's the use of this command? if someone would be so gentle to explain me that, please? there is a command call `w', which already does this kind of stuff and there is already a finger command installed... and what about the following discrepancies: · pinky -s · pinky -l => two different kinds of output for one and the same command - is this command *really* described in the POSIX specs and in that way? I can hardly believe that - instead it looks like a wet dream to me - or am I wrong? maybe some programmers do have too much spare time by their hands... ;-) · NEWS: why is the above bug, which I reported, *not* listed within the NEWS file, clearly stated as a fixed bug? or do I have always slowfully have to download a big, fat package paying a lot of money to my provider using an analog modem just for getting the news by inspecting the lengthy Changelog file? BTW, while reading the above NEWS file I really wonder why v5.2.1 is doing it's job... · fprintf, printf, fputs, fputc, putc, putchar: I may be wrong, but I seem to remember me, that some time ago the GNU conding style said something about *not* using each and every output function... but maybe things have changed · configure run: I was really astonnished - my (and that's absolutely true) libc5 based linux system is old, but it *works* and is running fast and I heard RMS *several* times with my own ears about harrasing against commercial software - and this 1.7 MB fat configure file is checking for a M$windog system? my old unix-like system is called deprecated and support has been cancelled by e.g. the gdb package, even though all checking routines were present, since it was supported sometime ago - and now M$, which kicks-ass each and every standard just to enslave their users will be supported in the big style? -> folks, that makes *me* think, really think... · performance of the dd command: the execution speed of dd sucks heavily, if the ibs and obs parameters are *not* the same, which is true for *most* small jobs, for which a unix-user uses this command -> maybe you should think about integrating J.S. sdd command, which beats dd by factors... as an example - just think about extracting a mpeg-stream out of an AVI container, where 3 dd executions are neccessary in order to extract the top, middle and bottom part, so to be able to reproduce the original XA format again -> time to play with my two female slaves as otherwise I had to take a sleep in front of my computer screen --- I'm *not* upgrading my v5.2.1 coreutils package - instead I quickly fix the above bug myself - and I'm going to think in the future about writing those things completely by myself, as it looks like the days are really over, where GNU software stands for well-developed software tools. Sorry for that, but I'm getting sick and tired lately, if I had to see folks out there, which believe, that only if they have nothing better to do than to recompile the fucking system day-in and day-out, everyone else have to do the same things. Please people, rethink about that - I do own two female slaves, which *always* are capable to provide me with much more pleasure than "upgrading" each and every tool, simply because some nerd think, that he has to use this one fucking gimmick, which makes an alternative tool unusable. (and I'm in the programming business for more than 20 years now...) THX for listening. CU Tom. (Thomas M.Ott) Germany From MAILER-DAEMON Wed Sep 28 16:19:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKiOn-0002t8-7e for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 16:19:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKiOj-0002ro-Aa for bug-coreutils@gnu.org; Wed, 28 Sep 2005 16:19:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKiOf-0002pL-5j for bug-coreutils@gnu.org; Wed, 28 Sep 2005 16:19:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKiOe-0002p4-U4 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 16:19:21 -0400 Received: from [216.148.227.117] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKiON-0004FX-Ty for bug-coreutils@gnu.org; Wed, 28 Sep 2005 16:19:04 -0400 Received: from 204.127.197.112 ([204.127.197.112]) by comcast.net (rwcrmhc11) with SMTP id <20050928201902013003r7kde>; Wed, 28 Sep 2005 20:19:02 +0000 Received: from [128.170.36.44] by 204.127.197.112; Wed, 28 Sep 2005 20:19:02 +0000 From: ericblake@comcast.net (Eric Blake) To: Paul Eggert , bug-coreutils@gnu.org Date: Wed, 28 Sep 2005 20:19:02 +0000 Message-Id: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: ian@caliban.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 20:19:27 -0000 [cc-ing bash-completion maintainer] > First, I recall that you preferred the non-POSIX behavior because of > file name completion issues. But because we agitated about this a > while ago, Bash now does a better job with file name completion. For > example, given this: > > mkdir dir > ln -s dir symlink > > If I type "mv sym[TAB]", where [TAB] stands for a tab character, the > screen then looks like this: > > mv symlink > > If I type another [TAB] it then looks like this: > > mv symlink/ This assumes, of course, that you don't have 'set mark-symlinked-directories on' in your ~/.inputrc, at which point a single [TAB] completes the trailing slash. On the other hand, with the bash-completion package, it might make sense for programmable completion for mv, cp, and rm to omit the trailing slash in spite of the mark-symlinked-directories setting. The only argument against this is that there is no way to know whether the user really meant to move (or copy or delete) the symlink to a directory, vs. a file located in the directory, until they move on to the next word or hit Enter. This was the entire reason that mark-symlinked-directories exists in readline, and --strip-trailing-slashes exists as an option to mv and cp. On a related note, why don't rm and rmdir have a --strip-trailing-slashes option? > > so I'm given a signal from Bash that I have a symlink to a directory, > and that it matters whether there's a trailing slash. > > > Second, I just read the POSIX spec and it seems to be a bit buggy > . > The rationale says "Renaming dot or dot-dot is prohibited" but I can't > see anything to that effect in the text itself. Agreed - we should bring this up with the austin group. Something along the lines of this statement from rmdir(): "If the path argument refers to a path whose final component is either dot or dot-dot, rmdir() shall fail." ... "[EINVAL] The path argument contains a last component that is dot." > > Furthermore, POSIX says that a pathname like "abc/" must be resolved > as if it were "abc/." (see > 1>) > so arguably rename("abc/", "def") must be handled like rename("abc/.", > "def") and if renaming dot or dot-dot is prohibited (which I think it > must be, even if it's omitted inadvertently from the standard) then > this must fail. I agree with your logic here on rename(2) needing to fail on a trailing slash if it is also supposed to fail on a trailing dot. But that doesn't necessarily mean that mv(1) need to fail on a trailing slash or dot. > > There's a similar issue with "rmdir symlink/". It's not clear that > rmdir ("symlink/") should succeed, because pathname resolution > indicates that it should be treated like rmdir ("symlink/.") and this > clearly must fail. Oops - cygwin has a bug in this regards: $ mkdir dir $ rmdir dir/. $ echo $? 0 $ ls dir ls: dir: No such file or directory Is it worth patching coreutils rm and rmdir to work around buggy systems that don't follow this POSIX restriction on rmdir()? (Meanwhile, I will try to get cygwin fixed.) Should we update the coreutils testsuite? > > My kneejerk reaction is that I might prefer it if "mv symlink/ foo" > and "rmdir symlink/" always failed, if only because in a confusing > situation like this it's often better to use the Hippocratic rule: > first, do no harm. It would be easy to implement that rule: it > wouldn't require any system calls at all, since we could simply reject > all file names with trailing slashes. You could probably convince me that your proposed approach of always rejecting an operation with a trailing slash is valid, as long as the error message gives a hint to the user on how to do what they wanted, and as long as --strip-trailing-slashes still worked. On the other hand, since 'mv symlink/ foo' invokes underspecified behavior in rename(2), maybe we can get away with deciding that mv(1) always behaves as --strip-trailing-slashes - is there anything in POSIX that would prohibit us from always stripping the trailing slash and acting on the symlink without an explicit option requesting that behavior? -- Eric Blake From MAILER-DAEMON Wed Sep 28 17:12:44 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKjEK-0000nc-83 for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:12:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKjEF-0000lD-T7 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:12:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKjEF-0000kj-5h for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:12:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKjDh-0000DM-2x for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:12:05 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKj2m-00071Q-TN for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:00:49 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 065EF6AC9; Wed, 28 Sep 2005 23:00:48 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87slvpujzk.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Wed, 28 Sep 2005 11:26:23 -0700") References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> <20050926171740.GA8154@gallifrey> <4338C662.9030504@byu.net> <87vf0lia48.fsf@rho.meyering.net> <87slvpujzk.fsf@penguin.cs.ucla.edu> Date: Wed, 28 Sep 2005 23:00:47 +0200 Message-ID: <878xxghpq8.fsf@rho.meyering.net> Lines: 83 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 21:12:40 -0000 Paul Eggert wrote: > Jim Meyering writes: > >> As you can imagine, I find the POSIX-required behavior to be senseless. > > Two things. > > First, I recall that you preferred the non-POSIX behavior because of > file name completion issues. But because we agitated about this a That was indeed a motivator, since it made the commands with ambiguous syntax more likely. > while ago, Bash now does a better job with file name completion. For > example, given this: ... > and so there was more of an argument that "mv symlink/ target" should > ignore the slash. Nowadays, though, isn't that argument weaker? Even if bash fixes things to make this less likely, there's still plenty of room for user error and confusion, especially since less-seasoned users still use shells that cannot -- or are not configured to -- clean up the syntax of their commands. Personally, this hasn't affected me for some time (since I switched to zsh). zsh can be configured so that it completes the trailing slash in I type mv symli zsh does this: mv symlink/ But the moment I type the space after the zsh-added `/', zsh removes that slash. If I type the slash, zsh leaves it. That said, I looked in some old command history logs and see hundreds of commands I typed (back before using zsh) including trailing slashes like this: mv dir/ new-name I know lots of people who would be very annoyed if they had to change habits or even just add an option via an alias to avoid failure in cases like those. > Second, I just read the POSIX spec and it seems to be a bit buggy > . > The rationale says "Renaming dot or dot-dot is prohibited" but I can't > see anything to that effect in the text itself. > > Furthermore, POSIX says that a pathname like "abc/" must be resolved > as if it were "abc/." (see > ) > so arguably rename("abc/", "def") must be handled like rename("abc/.", > "def") and if renaming dot or dot-dot is prohibited (which I think it > must be, even if it's omitted inadvertently from the standard) then > this must fail. > > There's a similar issue with "rmdir symlink/". It's not clear that > rmdir ("symlink/") should succeed, because pathname resolution > indicates that it should be treated like rmdir ("symlink/.") and this > clearly must fail. > > > Clearly it's a messy area. > > My kneejerk reaction is that I might prefer it if "mv symlink/ foo" > and "rmdir symlink/" always failed, if only because in a confusing > situation like this it's often better to use the Hippocratic rule: > first, do no harm. It would be easy to implement that rule: it > wouldn't require any system calls at all, since we could simply reject > all file names with trailing slashes. IMHO, such a move [making mv fail for any source argument specified with a trailing slash] would `do harm' :-) albeit to people's sensibilities when GNU mv starts griping, not to their files. I think the wrapper-induced overhead of an extra lstat imposed on losing systems, but only for operands with a trailing slash, is bearable. This is one of those `would be nice' things. But I'm not in any big hurry, since Linux 2.6.x does it right. From MAILER-DAEMON Wed Sep 28 17:13:12 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKjDM-0000U4-RW for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:11:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKjDF-0000Pu-A3 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:11:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKjD3-0000I9-Pi for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:11:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKjD2-0000DM-O2 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:11:24 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKjA1-0007Xw-OB for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:08:17 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id F38D16AC9; Wed, 28 Sep 2005 23:08:16 +0200 (CEST) From: Jim Meyering To: ericblake@comcast.net (Eric Blake) In-Reply-To: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Wed, 28 Sep 2005 20:19:02 +0000") References: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> Date: Wed, 28 Sep 2005 23:08:16 +0200 Message-ID: <873bnohpdr.fsf@rho.meyering.net> Lines: 24 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ian@caliban.org, Paul Eggert , bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 21:11:41 -0000 ericblake@comcast.net (Eric Blake) wrote: ... > On a related note, why don't rm and rmdir have a --strip-trailing-slashes > option? Because as far as I know, there is no need. Do you know of a system where `rmdir symlink/' removes only the referent of the symlink? ... > Oops - cygwin has a bug in this regards: > $ mkdir dir > $ rmdir dir/. > $ echo $? > 0 > $ ls dir > ls: dir: No such file or directory > > Is it worth patching coreutils rm and rmdir to work around buggy > systems that don't follow this POSIX restriction on rmdir()? (Meanwhile, > I will try to get cygwin fixed.) Should we update the coreutils testsuite? It depends a whole lot on how invasive or complicated the patch is. Ideally, it wouldn't change anything in src/*.c at all. From MAILER-DAEMON Wed Sep 28 17:16:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKjI5-0003D9-Oa for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:16:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKjI4-0003BE-1x for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:16:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKjI2-00039s-Sn for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:16:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKjDe-0000DM-TL for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:12:02 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKj3W-00072u-3T for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:01:34 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SL1V408260; Wed, 28 Sep 2005 14:01:31 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKj3T-0004Rm-90; Wed, 28 Sep 2005 14:01:31 -0700 To: ericblake@comcast.net (Eric Blake) References: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> From: Paul Eggert Date: Wed, 28 Sep 2005 14:01:31 -0700 In-Reply-To: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Wed, 28 Sep 2005 20:19:02 +0000") Message-ID: <877jd0vrdg.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ian@caliban.org, bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 21:16:36 -0000 ericblake@comcast.net (Eric Blake) writes: > Why don't rm and rmdir have a --strip-trailing-slashes option? I'd guess because that option is an ugly hack and we'd rather that the problem went away.... > we should bring this up with the austin group. Perhaps, but let's figure out what we want first. > I agree with your logic here on rename(2) needing to fail on a trailing > slash if it is also supposed to fail on a trailing dot. But that doesn't > necessarily mean that mv(1) need to fail on a trailing slash or dot. But POSIX says "mv a/ b" does the equivalent of rename("a/", "b"). So if you agree with the logic, then "mv a/ b" must fail. > Oops - cygwin has a bug in this regards: > $ mkdir dir > $ rmdir dir/. > $ echo $? > 0 > $ ls dir > ls: dir: No such file or directory > > Is it worth patching coreutils rm and rmdir to work around buggy > systems that don't follow this POSIX restriction on rmdir()? Naah, let's just get cygwin fixed. > On the other hand, since 'mv symlink/ foo' invokes underspecified > behavior in rename(2), maybe we can get away with deciding that > mv(1) always behaves as --strip-trailing-slashes POSIX may be underspecified, but it's not _that_ underspecified. :-) I think one could argue that "mv symlink/ foo" should rename the target of the symlink (which is what Solaris does), or that it should fail (which is what I'd mildly prefer); but I don't see a way to read POSIX to say that it allows mv to ignore the slash. Note that, by this argument, "mv dir/ foo" should fail even if "dir/" is an ordinary directory and is not a symlink. So it'd be kind of a big change. From MAILER-DAEMON Wed Sep 28 17:40:49 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKjfV-00055b-KS for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:40:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKjfT-000547-DU for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:40:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKjfS-00053V-Cv for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:40:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKjdC-0003Yi-QV for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:38:26 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKjR5-0000nP-Py for bug-coreutils@gnu.org; Wed, 28 Sep 2005 17:25:56 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id DE4728474; Wed, 28 Sep 2005 23:25:54 +0200 (CEST) From: Jim Meyering To: ericblake@comcast.net (Eric Blake) In-Reply-To: <092820051413.25843.433AA51D000CFED2000064F322007510900A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Wed, 28 Sep 2005 14:13:50 +0000") References: <092820051413.25843.433AA51D000CFED2000064F322007510900A050E040D0C079D0A@comcast.net> Date: Wed, 28 Sep 2005 23:25:54 +0200 Message-ID: <87wtl0g9zx.fsf@rho.meyering.net> Lines: 49 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 21:40:48 -0000 ericblake@comcast.net (Eric Blake) wrote: >> As you can imagine, I find the POSIX-required behavior to be senseless. >> The above behavior of non-POSIX rename, seen on Linux-2.6.x, is fine. >> Now that Linux/glibc provides a sane rename function, I'm tempted >> to make mv work in the above manner on all systems rather than allowing >> the crazy move-pointed-to-directory behavior on systems with a >> technically-conforming rename. >> >> The wrapper will incur the expense of a syscall or two on losing systems >> when the first argument ends with `/'. > > If you do that, you need to make sure POSIXLY_CORRECT still > gets the POSIX behavior of move-pointed-to-directory. But Not if I deem that behavior senseless :-) Can you imagine any real user (non-standards-weenie) *wanting* or even expecting that behavior? The few people I've shown that example to in person have always looked a little slack-jawed and expressed dismay that such silly behavior is mandated. > wasn't this the reason that --strip-trailing-slashes was created > as an option? That way, a user can do > alias mv='mv --strip-trailing-slashes' > and get the sane behavior of always moving the symlink, not the > pointed-to-directory, regardless of whether rename() is > conformant or not, and regardless of whether their shell's > tab-completion puts slashes on symlinks-to-directories. Right. But as long as Linux's rename had the unwanted behavior, I was unwilling to impose the overhead of a wrapper. Now that constraint is removed. > Meanwhile, since you think that the POSIX definition of rename() > is insane, try filing an aardvark to allow an implementation-defined > choice between moving the symlink/moving the directory, rather > than the current mandated semantics of moving the directory. That > way, Linux 2.6.x would still be able to comply to POSIX with what > you term to be saner semantics (personally, I like the POSIX-mandated > semantics, as it provides a consistent way to choose between > operating on the symlink vs. operating on what it points to by > the presence of the trailing slash, and it is not just rename() that > is affected by POSIX semantics). Or you could file an aardvark > on mv(1) to allow an implementation to always strip trailing slashes > before calling rename(). I don't want to give myself that kind of work right now. Besides, I don't lose sleep if a GNU tool or two deviate from POSIX on corner cases like this. One way or another, we'll all converge, eventually. From MAILER-DAEMON Wed Sep 28 18:14:08 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkBj-0007wW-DN for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:14:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkBg-0007uB-NG for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:14:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkBd-0007sH-Kd for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:14:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkBd-0007ro-Cm for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:14:01 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkAu-0004Ah-I7 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:13:16 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SMD7414227; Wed, 28 Sep 2005 15:13:07 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKkAk-0003uP-VA; Wed, 28 Sep 2005 15:13:06 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> From: Paul Eggert Date: Wed, 28 Sep 2005 15:13:06 -0700 In-Reply-To: <433AF0EF.3499CE39@gmx.de> (thmo-13@gmx.de's message of "Wed, 28 Sep 2005 21:37:19 +0200") Message-ID: <871x38vo25.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:14:05 -0000 ThMO writes: > =C2=B7 even though the C compiler might be able to deal with 64-bit integ= er values, > this must *not* be the case with the C pre-processor: > > #define ULLONG_MAX 18446744073709551615ULL > > the C compiler (gcc v2.7.2.1) *is* able to deal with that value, but the > cpp can't Ouch. Thanks for reporting the problem; this is due, I think, to a change installed in January. Can you please try the following private snapshot instead? http://www.cs.ucla.edu/~eggert/coreutils-5.3.1-20050928-eggert.tar.gz It has the following patch installed (which I also installed into CVS coreutils): 2005-09-28 Paul Eggert * m4/ullong_max.m4 (gl_ULLONG_MAX): Simplify so that it merely defines ULONG_MAX_LT_ULLONG_MAX. Thomas M.Ott reports that ULLONG_MAX doesn't work with 2.7.2.1. * src/system.h (LONGEST_MODIFIER): Use ULONG_MAX_LT_ULLONG_MAX instead of ULLONG_MAX, as the latter doesn't work with GCC 2.7.2.1. Index: m4/ullong_max.m4 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /fetish/cu/m4/ullong_max.m4,v retrieving revision 1.2 diff -p -u -r1.2 ullong_max.m4 --- m4/ullong_max.m4 22 Jan 2005 06:25:53 -0000 1.2 +++ m4/ullong_max.m4 28 Sep 2005 22:04:09 -0000 @@ -11,36 +11,17 @@ AC_DEFUN([gl_ULLONG_MAX], [ dnl Avoid _AC_COMPUTE_INT-related macros, as they may not work with dnl types wider than long int, due to problems with expr. - AC_CACHE_CHECK([for ULLONG_MAX], gl_cv_ullong_max, - [gl_cv_ullong_max=3Dno - AC_EGREP_CPP([ULLONG_MAX is defined], - [ - #include - #ifdef ULLONG_MAX - "ULLONG_MAX is defined" - #endif - ], - [gl_cv_ullong_max=3Dyes]) - case $gl_cv_ullong_max in - no) - for gl_expr in \ - 18446744073709551615ULL \ - 4722366482869645213695ULL \ - 340282366920938463463374607431768211455ULL - do - AC_TRY_COMPILE([], - [char test[$gl_expr =3D=3D (unsigned long long int) -1 ? 1 : -1]; - static unsigned long long int i =3D $gl_expr; - return i && test;], - [gl_cv_ullong_max=3D$gl_expr]) - test $gl_cv_ullong_max !=3D no && break - done - esac]) - case $gl_cv_ullong_max in - yes | no) ;; - *) - AC_DEFINE_UNQUOTED([ULLONG_MAX], [$gl_cv_ullong_max], - [Define as the maximum value of the type 'unsigned long long int', - if the system doesn't define it, and if the system has that type.])= ;; - esac + AC_CACHE_CHECK([whether ULONG_MAX < ULLONG_MAX], + [gl_cv_ulong_max_lt_ullong_max], + [AC_COMPILE_IFELSE( + [AC_LANG_BOOL_COMPILE_TRY( + [AC_INCLUDES_DEFAULT], + [[(unsigned long int) -1 < (unsigned long long int) -1]])], + [gl_cv_ulong_max_lt_ullong_max=3Dyes], + [gl_cv_ulong_max_lt_ullong_max=3Dno])]) + if test $gl_cv_ulong_max_lt_ullong_max =3D yes; then + AC_DEFINE([ULONG_MAX_LT_ULLONG_MAX], 1, + [Define if ULONG_MAX < ULLONG_MAX, even if your compiler does not + support ULLONG_MAX.]) + fi ]) Index: src/system.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /fetish/cu/src/system.h,v retrieving revision 1.136 diff -p -u -r1.136 system.h --- src/system.h 23 Sep 2005 20:35:41 -0000 1.136 +++ src/system.h 28 Sep 2005 22:04:09 -0000 @@ -316,7 +316,7 @@ initialize_exit_failure (int status) # include #endif =20 -#if ULONG_MAX < ULLONG_MAX +#if ULONG_MAX_LT_ULLONG_MAX # define LONGEST_MODIFIER "ll" #else # define LONGEST_MODIFIER "l" From MAILER-DAEMON Wed Sep 28 18:15:12 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkCl-0000Jk-Vu for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:15:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkCk-0000JB-Ad for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:15:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkCg-0000I1-Vz for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:15:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkCg-0000Hl-FU for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:15:06 -0400 Received: from [204.127.198.54] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkCX-0004Oo-9Y for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:14:57 -0400 Received: from 204.127.197.111 (rmailcenter18.comcast.net[204.127.197.128]) by comcast.net (rwcrmhc14) with SMTP id <2005092822145501400b1fsge>; Wed, 28 Sep 2005 22:14:55 +0000 Received: from [128.170.36.44] by 204.127.197.111; Wed, 28 Sep 2005 22:14:54 +0000 From: ericblake@comcast.net (Eric Blake) To: Jim Meyering Date: Wed, 28 Sep 2005 22:14:54 +0000 Message-Id: <092820052214.26861.433B15DD000E3517000068ED22070009530A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: ian@caliban.org, Paul Eggert , bug-coreutils@gnu.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:15:11 -0000 > > On a related note, why don't rm and rmdir have a --strip-trailing-slashes > > option? > > Because as far as I know, there is no need. > Do you know of a system where `rmdir symlink/' > removes only the referent of the symlink? Yes, cygwin (but again, that goes back to the rmdir(2) bug in cygwin that I have just reported to the cygwin maintainers): $ mkdir a $ ln -s a b $ rmdir b/ $ ls -F a b ls: a: No such file or directory b@ Whereas on sane systems (for example, Solaris 8): $ mkdir a $ ln -s a b $ rmdir b/ rmdir: directory "b/": Path component not a directory $ rmdir b/. rmdir: directory "b/.": Can't remove current directory or .. By Paul's argument, both uses should have failed with EINVAL, since POSIX requires resolving "symlink/" as "symlink/.", and requires rmdir("symlink/." to fail with EINVAL. Solaris 8 returned ENOTDIR in the first case, so it appears they stripped the trailing slash (and their error message leaves something to be desired in accuracy in the second case). But at least it reliably failed instead of removing a. I don't have access to other systems to see what other behaviors might exist. > > Is it worth patching coreutils rm and rmdir to work around buggy > > systems that don't follow this POSIX restriction on rmdir()? (Meanwhile, > > I will try to get cygwin fixed.) Should we update the coreutils testsuite? > > It depends a whole lot on how invasive or complicated the patch is. > Ideally, it wouldn't change anything in src/*.c at all. If cygwin doesn't get patched, it sounds like a gnulib module to replace rmdir() is all that would be needed. Something like this untested snippet (it would need to be cleaned up for corner cases like "", "/", ".", but you get the picture): int rpl_rmdir(const char* name) { int len = strlen (name); if (name[len - 1] == '/' || (name[len - 1] == '.' && (name[len - 2] == '/' || (name[len - 2] == '.' && name[len - 3] == '/')))) { errno = EINVAL; return -1; } return rmdir (name); } -- Eric Blake From MAILER-DAEMON Wed Sep 28 18:21:13 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkIa-0002V8-MA for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:21:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkIK-0002Px-Jf for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:20:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkIC-0002LR-Jf for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:20:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkI9-0002G5-7q for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:20:45 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkDl-0004VL-6K for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:16:13 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SMFx414518; Wed, 28 Sep 2005 15:16:00 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKkDW-0003uS-UD; Wed, 28 Sep 2005 15:15:58 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> From: Paul Eggert Date: Wed, 28 Sep 2005 15:15:58 -0700 In-Reply-To: <433AF0EF.3499CE39@gmx.de> (thmo-13@gmx.de's message of "Wed, 28 Sep 2005 21:37:19 +0200") Message-ID: <87wtl0u9cx.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org, Bob Proulx Subject: Re: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:20:58 -0000 ThMO writes: > =C2=B7 lib/getdate.y: > I'm using bison v1.28 - and for me it's unacceptable, that this grammar > can't be processed corrrectly with this older version, You shouldn't need to process it at all, since getdate.c is present in the source distribution. Perhaps the time stamps on your files were corrupted? > it should also be processed by stock berkeley yacc But that wouldn't support reentrant parsers. getdate needs to be reentrant, for other projects. It should not be a problem anyway; you shouldn't need to run either Bison or Yacc. > BTW, is anyone able to guarantee me, that bison v2.0 has not even one > problem with processing older (and oldest - I'm using software packages > dated in the early 80's) grammar files? Someone could guarantee you that, yes, if you paid them enough. :-) But the FSF isn't rich and can't afford to give out guarantees like that. "bison --version" clearly says "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE". > =C2=B7 src/su.c: This one tends to be so distribution-dependent that we're thinking of dropping 'su' from coreutils. > =C2=B7 --disable-nls: > IMHO there is no need, if I decide to configure *wihtout* NLS support, > which I usually do, to setup a specific locale, --disable-nls affects only diagnostics and the like: it does not disable all usages of locales. For example, LC_CTYPE still affects whether something is considered to be a letter. > the man-page should *always* reflect the various options, for which a > command was configured for The dd man page has changed in the latest CVS version; perhaps the point is moot now. To be honest I didn't fully follow your comments. "info coreutils dd" works on my host and that is what the man page suggests. > =C2=B7 factor: > it's increddible - your factor command is *not* able to factorize negat= ive > values Patches would we welcome here. > only this command knowns nothing about the --help switch Fixed in 5.3.0. > =C2=B7 NEWS: > why is the above bug, which I reported, *not* listed within the NEWS fi= le, > clearly stated as a fixed bug? NEWS reports only important user-visible fixes. I don't know which bug you meant by "the above bug". If we forgot to put a bugfix in NEWS and it's important please tell it what it was. > =C2=B7 fprintf, printf, fputs, fputc, putc, putchar: > I may be wrong, but I seem to remember me, that some time ago the GNU > conding style said something about *not* using each and every output > function... I don't recall that as being a rule. Certainly these functions are all used in a lot of GNU code. > =C2=B7 configure run: > this 1.7 MB fat configure file is checking for a M$windog system? We'd like to make it smaller and faster, yes. Contributions toward that end would be welcome. They should go to autoconf-patches@gnu.org, since it's an Autoconf problem not a coreutils problem. > =C2=B7 performance of the dd command: > the execution speed of dd sucks heavily, Can you give a specific example of the problem? A shell transcript would help. Thanks again for your comments. (Though we don't really need to know about your sex life....) From MAILER-DAEMON Wed Sep 28 18:23:42 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkL0-0003JN-Mz for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:23:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkKz-0003IU-1d for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:23:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkKx-0003Hk-SW for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:23:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkKx-0003HW-Mm for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:23:39 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkKe-00052N-8M for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:23:20 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SMNJ415771; Wed, 28 Sep 2005 15:23:19 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKkKd-0003ub-3g; Wed, 28 Sep 2005 15:23:19 -0700 To: bug-coreutils@gnu.org References: <092820052019.11085.433AFAB5000CBD3B00002B4D22007507440A050E040D0C079D0A@comcast.net> <873bnohpdr.fsf@rho.meyering.net> From: Paul Eggert Date: Wed, 28 Sep 2005 15:23:19 -0700 In-Reply-To: <873bnohpdr.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 28 Sep 2005 23:08:16 +0200") Message-ID: <87slvou90o.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ian@caliban.org, "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:23:41 -0000 Jim Meyering writes: > Do you know of a system where `rmdir symlink/' > removes only the referent of the symlink? Lots of systems do that, I expect. Solaris 10 does, for example. This is either with Solaris rmdir or coreutils 5.3.0 rmdir. I wouldn't be surprised if core commands other than mv and rmdir are affected by this issue as well. rm and ln come to mind, though I haven't tested them. Here's a transcript on Solaris 10 (sparc) with coreutils 5.3.0: 1018-otter $ ls -l total 2 drwxrwxr-x 2 eggert faculty 512 2005-09-28 15:18 dir lrwxrwxrwx 1 eggert faculty 3 2005-09-28 15:18 symlink -> dir 1019-otter $ rmdir symlink/ 1020-otter $ ls -l total 1 lrwxrwxrwx 1 eggert faculty 3 2005-09-28 15:18 symlink -> dir From MAILER-DAEMON Wed Sep 28 18:37:31 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkYM-00065z-PL for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkYB-000638-Pj for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkY1-0005uo-39 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkXy-0005sP-Or for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:06 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkVv-0005fw-RL for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:35:00 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8SMYw416678; Wed, 28 Sep 2005 15:34:58 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EKkVt-0003uf-Uc; Wed, 28 Sep 2005 15:34:57 -0700 To: bug-coreutils@gnu.org References: <20050925193648.GA8174@gallifrey> <874q88x4rj.fsf@rho.meyering.net> <20050926171740.GA8154@gallifrey> <4338C662.9030504@byu.net> <87vf0lia48.fsf@rho.meyering.net> <87slvpujzk.fsf@penguin.cs.ucla.edu> <878xxghpq8.fsf@rho.meyering.net> From: Paul Eggert Date: Wed, 28 Sep 2005 15:34:57 -0700 In-Reply-To: <878xxghpq8.fsf@rho.meyering.net> (Jim Meyering's message of "Wed, 28 Sep 2005 23:00:47 +0200") Message-ID: <87oe6cu8ha.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Dr. David Alan Gilbert" Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:37:23 -0000 Jim Meyering writes: > I think the wrapper-induced overhead of an extra lstat imposed on losing > systems, but only for operands with a trailing slash, is bearable. > This is one of those `would be nice' things. > But I'm not in any big hurry, since Linux 2.6.x does it right. Yes, I wouldn't be in any hurry either. Come to think of it, how about if we just stick to the current approach, and let 'mv' use the system rename() function and do whatever rename() does? Advantages of the current approach: * Easier to implement and maintain. * Solaris folks used to Solaris mv's behavior won't be surprised by GNU mv. * GNU mv conforms to POSIX, on POSIX-conforming hosts. (On non-POSIX hosts all bets are off anyway. :-) Disadvantages: * GNU mv behaves differently on different hosts. Similarly for rmdir and rmdir(), etc. I suppose either way, the eocumentation needs to explain the issue better. (Arrgh.) From MAILER-DAEMON Wed Sep 28 18:37:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKkYQ-0006A5-6C for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKkYG-00065I-9w for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKkY7-0005zK-I9 for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKkY4-0005sP-Ii for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:37:12 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkR6-0005RA-Se for bug-coreutils@gnu.org; Wed, 28 Sep 2005 18:30:01 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id C82996AC9; Thu, 29 Sep 2005 00:29:59 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Date: Thu, 29 Sep 2005 00:29:59 +0200 Message-ID: <87r7b8g714.fsf@rho.meyering.net> Lines: 10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: FYI: upcoming test release to be called coreutils-5.90 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 22:37:31 -0000 The upcoming test release will be called coreutils-5.90. There have been so many changes since 5.3.0, that calling it 5.3.1 didn't seem right. Besides, having a 3-component version number isn't very useful now. 2005-09-28 Jim Meyering * configure.ac: Use 5.90-cvs as the version string, not 5.3.1-cvs. * NEWS: Adjust accordingly. From MAILER-DAEMON Wed Sep 28 19:09:01 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKl2n-00060t-4c for mharc-bug-coreutils@gnu.org; Wed, 28 Sep 2005 19:08:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKl2f-0005w5-Gg for bug-coreutils@gnu.org; Wed, 28 Sep 2005 19:08:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKl2Y-0005sl-Qs for bug-coreutils@gnu.org; Wed, 28 Sep 2005 19:08:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKl2Y-0005pJ-9R for bug-coreutils@gnu.org; Wed, 28 Sep 2005 19:08:42 -0400 Received: from [216.148.227.118] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKkzb-0007ac-Ql for bug-coreutils@gnu.org; Wed, 28 Sep 2005 19:05:39 -0400 Received: from 204.127.197.119 (rmailcenter77.comcast.net[204.127.197.177]) by comcast.net (rwcrmhc13) with SMTP id <2005092823053301500ruprme>; Wed, 28 Sep 2005 23:05:38 +0000 Received: from [128.170.36.44] by 204.127.197.119; Wed, 28 Sep 2005 23:05:31 +0000 From: ericblake@comcast.net (Eric Blake) To: Jim Meyering Date: Wed, 28 Sep 2005 23:05:31 +0000 Message-Id: <092820052305.4643.433B21BA000C88BB0000122322007510900A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: Paul Eggert , bug-coreutils@gnu.org Subject: Re: mv trailing slash warning X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2005 23:08:53 -0000 > > On a related note, why don't rm and rmdir have a --strip-trailing-slashes > > option? > > Because as far as I know, there is no need. > Do you know of a system where `rmdir symlink/' > removes only the referent of the symlink? By a strict reading of http://www.opengroup.org/onlinepubs/009695399/utilities/rm.html, 'rm -R symlink/' should empty the referrant, then fail! step 0: the command line does not end in . step 1: symlink/ exists step 2: 'symlink/' is of type directory ('symlink', on the other hand, is of type symlink); this is the recursion, ending with the referrant being emptied, and symlink and symlink/ still existing step 3: 'symlink/' is a directory step 4: call rmdir("symlink/"), which should fail with EINVAL But no implementation of rm(1) that I am aware of does this; they all unlink symlink and call it quits, leaving the referrant (and its contents) alone. We really do need to clean this up with the austin group; surely they intended to document historical behavior. -- Eric Blake From MAILER-DAEMON Thu Sep 29 01:04:51 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKqbC-00037i-LM for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 01:04:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKqav-00031I-KL for bug-coreutils@gnu.org; Thu, 29 Sep 2005 01:04:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKqao-0002xu-AF for bug-coreutils@gnu.org; Thu, 29 Sep 2005 01:04:27 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKqan-0002wX-I2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 01:04:25 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKqWu-0002cw-Do for bug-coreutils@gnu.org; Thu, 29 Sep 2005 01:00:24 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id E8D324B2E8; Wed, 28 Sep 2005 23:00:21 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id D8F8D15BA06; Wed, 28 Sep 2005 23:00:21 -0600 (MDT) Date: Wed, 28 Sep 2005 23:00:21 -0600 To: bug-coreutils@gnu.org Message-ID: <20050929050021.GA31421@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org, ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <87wtl0u9cx.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Content-Transfer-Encoding: quoted-printable Cc: ThMO Subject: Re: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 05:04:38 -0000 Paul Eggert wrote: > ThMO writes: > > =B7 NEWS: > > why is the above bug, which I reported, *not* listed within the > > NEWS file, clearly stated as a fixed bug? >=20 > NEWS reports only important user-visible fixes. I don't know which > bug you meant by "the above bug". If we forgot to put a bugfix in > NEWS and it's important please tell it what it was. I could not find a NEWS entry on this item either. This is a significant enough item that I think it should have one. After I responded to Tom and the list I posted this note as a followup to the bug-coreutils list only. It seemed germane only to the coreutils developers on the list and so that is where I directed it. http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00178.html Bob From MAILER-DAEMON Thu Sep 29 02:35:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKs0g-0007CY-RY for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 02:35:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKs0c-00076A-QZ for bug-coreutils@gnu.org; Thu, 29 Sep 2005 02:35:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKs0Y-00072V-5v for bug-coreutils@gnu.org; Thu, 29 Sep 2005 02:35:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKs0X-00071w-MR for bug-coreutils@gnu.org; Thu, 29 Sep 2005 02:35:05 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKrzn-0008I8-KT for bug-coreutils@gnu.org; Thu, 29 Sep 2005 02:34:19 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 5E481C77; Thu, 29 Sep 2005 08:34:18 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org In-Reply-To: <20050929050021.GA31421@dementia.proulx.com> (Bob Proulx's message of "Wed, 28 Sep 2005 23:00:21 -0600") References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <20050929050021.GA31421@dementia.proulx.com> Date: Thu, 29 Sep 2005 08:34:18 +0200 Message-ID: <87ek78fklx.fsf@rho.meyering.net> Lines: 23 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ThMO Subject: Re: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 06:35:12 -0000 bob@proulx.com (Bob Proulx) wrote: > Paul Eggert wrote: >> ThMO writes: >> > * NEWS: >> > why is the above bug, which I reported, *not* listed within the >> > NEWS file, clearly stated as a fixed bug? >> >> NEWS reports only important user-visible fixes. I don't know which >> bug you meant by "the above bug". If we forgot to put a bugfix in >> NEWS and it's important please tell it what it was. > > I could not find a NEWS entry on this item either. This is a > significant enough item that I think it should have one. After I > responded to Tom and the list I posted this note as a followup to the > bug-coreutils list only. It seemed germane only to the coreutils > developers on the list and so that is where I directed it. > > http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00178.html Thanks. I've added this: stat now exits nonzero if a file operand does not exist From MAILER-DAEMON Thu Sep 29 08:32:52 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKxal-00065F-C9 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 08:32:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKxai-00063W-5p for bug-coreutils@gnu.org; Thu, 29 Sep 2005 08:32:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKxYT-00057B-3p for bug-coreutils@gnu.org; Thu, 29 Sep 2005 08:30:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKxXU-0004XK-JD; Thu, 29 Sep 2005 08:29:28 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKxQH-0001jZ-9L; Thu, 29 Sep 2005 08:22:01 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 2B9C28359; Thu, 29 Sep 2005 14:22:00 +0200 (CEST) From: Jim Meyering To: bug-autoconf@gnu.org, bug-coreutils@gnu.org Date: Thu, 29 Sep 2005 14:22:00 +0200 Message-ID: <87br2cdpxz.fsf@rho.meyering.net> Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: Warning! autoconf can generate very long lines in Makefiles X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 12:32:48 -0000 coreutils' Makefiles are currently created using automake-1.9.6 and autoconf-2.59c There are some very long lines in the Makefiles generated for upcoming coreutils-5.90. Here's an example: LIBOBJS = ${LIBOBJDIR}backupfile$U.o ${LIBOBJDIR}basename$U.o ... The LTLIBOBJS definition had the same problem, and I see that am__DEPENDENCIES_1 is also very long. $ grep -E '^.{2000}' */Makefile|sed 's/=.*/=/' doc/Makefile:LIBOBJS = doc/Makefile:LTLIBOBJS = lib/Makefile:am__DEPENDENCIES_1 = lib/Makefile:LIBOBJS = lib/Makefile:LTLIBOBJS = man/Makefile:LIBOBJS = man/Makefile:LTLIBOBJS = src/Makefile:LIBOBJS = src/Makefile:LTLIBOBJS = tests/Makefile:LIBOBJS = tests/Makefile:LTLIBOBJS = Not only will this cause trouble with non-GNU Make programs, but the scripts in config.status that perform the s/@LIBOBJS@/.../ substitution may be too long for some non-GNU versions of sed. Note that this is *not* a problem with automake. The Makefile.in files are all fine. In Makefile.in, the lines look like these: LIBOBJS = @LIBOBJS@ LTLIBOBJS = @LTLIBOBJS@ am__DEPENDENCIES_1 = @LIBOBJS@ Of course, we can suggest that people use GNU sed and GNU make, and that will work -- assuming they never end up with so many lib/*.c files that this problem afflicts one of them, too. That would be a problem. From MAILER-DAEMON Thu Sep 29 09:20:30 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EKyKq-0005LU-Ud for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 09:20:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKyKm-0005KP-Mj for bug-coreutils@gnu.org; Thu, 29 Sep 2005 09:20:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKyKk-0005Jb-8E for bug-coreutils@gnu.org; Thu, 29 Sep 2005 09:20:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKyKi-0005FK-MN for bug-coreutils@gnu.org; Thu, 29 Sep 2005 09:20:21 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EKyHV-0006PX-0H for bug-coreutils@gnu.org; Thu, 29 Sep 2005 09:17:01 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 38985851C; Thu, 29 Sep 2005 15:17:00 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Date: Thu, 29 Sep 2005 15:17:00 +0200 Message-ID: <87achwc8tv.fsf@rho.meyering.net> Lines: 38 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: FYI: settime.c doesn't compile on OSF1 V5.1 due to stime X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 13:20:26 -0000 Here's the work-around I'm using: 2005-09-29 Jim Meyering * settime.c (settime): Move the HAVE_STIME block `up' into an #elif block, so that we don't even try to compile it if settimeofday is available. This works around a compilation failure on OSF1 V5.1, due to stime requiring a `long int*' while tv_sec is `int'. Index: lib/settime.c =================================================================== RCS file: /fetish/cu/lib/settime.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -u -r1.6 -r1.7 --- lib/settime.c 22 Sep 2005 06:05:39 -0000 1.6 +++ lib/settime.c 29 Sep 2005 13:13:49 -0000 1.7 @@ -61,12 +61,16 @@ settime (struct timespec const *ts) if (r == 0 || errno == EPERM) return r; } +#elif HAVE_STIME + { + /* This fails to compile on OSF1 V5.1, due to stime requiring + a `long int*' and tv_sec is `int'. But that system does provide + settimeofday. */ + int r = stime (&ts->tv_sec); + if (r == 0 || errno == EPERM) + return r; #endif -#if HAVE_STIME - return stime (&ts->tv_sec); -#else errno = ENOSYS; return -1; -#endif } From MAILER-DAEMON Thu Sep 29 12:06:00 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL0uy-0002XJ-9u for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL0ur-0002Qy-Rw for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL0ul-0002OX-Tx for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL0ul-0002OC-Q2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:43 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EL0uk-0005FZ-Kx for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:43 -0400 Received: (qmail invoked by alias); 29 Sep 2005 16:05:28 -0000 Received: from dialin-145-254-244-184.arcor-ip.net (EHLO thommy.koffer.de) [145.254.244.184] by mail.gmx.net (mp034) with SMTP; 29 Sep 2005 18:05:28 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id SAA15721; Thu, 29 Sep 2005 18:04:22 +0200 Sender: root@thommy.koffer.de Message-ID: <433C1085.EE7C84F5@gmx.de> Date: Thu, 29 Sep 2005 18:04:21 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: Paul Eggert References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 Cc: bug-coreutils@gnu.org, Bob Proulx Subject: Re3: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 16:05:54 -0000 Hello Paul, Bob and others listening, > > · even though the C compiler might be able to deal with 64-bit integer values, > > this must *not* be the case with the C pre-processor: > > > > #define ULLONG_MAX 18446744073709551615ULL > > > > the C compiler (gcc v2.7.2.1) *is* able to deal with that value, but the > > cpp can't > > Ouch. Thanks for reporting the problem; this is due, I think, to a > change installed in January. Can you please try the following private > snapshot instead? > > http://www.cs.ucla.edu/~eggert/coreutils-5.3.1-20050928-eggert.tar.gz THX, I've downloaded it during the past 40 minutes and tried it out. Your fix solves this specific problem without further patching. But there's a new problem, although it falls into the same category, inside file lib/gethrxtime.c at line 70: the header file xtime.h defines: # if HAVE_LONG_LONG typedef long long int xtime_t; # define XTIME_PRECISION 1000000000LL # else ... #endif Again cpp groks about the `LL' modifier. --- > > · lib/getdate.y: > > I'm using bison v1.28 - and for me it's unacceptable, that this grammar > > can't be processed corrrectly with this older version, > > You shouldn't need to process it at all, since getdate.c is present in > the source distribution. Perhaps the time stamps on your files were > corrupted? No, I always reproduce every generated files... > > it should also be processed by stock berkeley yacc > > But that wouldn't support reentrant parsers. getdate needs to be > reentrant, for other projects. It should not be a problem anyway; > you shouldn't need to run either Bison or Yacc. O.K., reentrancy is an argument, but IMHO v1.28 does support pure parsers, although it might not be stated inside the info-pages. The specific point I meant was the directives %parse-param and %lex-param. This older version doesn't know about those directives, although there are defines for declaring them a little bit different, e.g. YYPARSE_PARAM and YYLEX_PARAM, if I remember it right - but you should know better, as I now know, where I heard your name from, as you're hacking on bison too. > > BTW, is anyone able to guarantee me, that bison v2.0 has not even one > > problem with processing older (and oldest - I'm using software packages > > dated in the early 80's) grammar files? > > Someone could guarantee you that, yes, if you paid them enough. :-) Yeah. :-) In the meanwhile I tried out bison v2.1, but wasn't successful with some grammar files, where I had to stuff together three SQL-select parsers using one flex-scanner and therefore had to, maybe misuse the C pre-processor, so I'll stick to my old version locally. > > · --disable-nls: > > IMHO there is no need, if I decide to configure *wihtout* NLS support, > > which I usually do, to setup a specific locale, > > --disable-nls affects only diagnostics and the like: it does not > disable all usages of locales. For example, LC_CTYPE still affects > whether something is considered to be a letter. Alright, so I am definitely wrong here. > > the man-page should *always* reflect the various options, for which a > > command was configured for > > The dd man page has changed in the latest CVS version; perhaps the > point is moot now. To be honest I didn't fully follow your comments. > "info coreutils dd" works on my host and that is what the man page suggests. All pre-processed man-pages refer to the info-pages as: info , but that should be named: info coreutils . To fix this problem for *all* man-pages inside the coreutils package you should extent the specific rule somewhat: # snipped from man/Makefile .x.1: @rm -f $@ @echo "Updating man page $@"; \ mkdir $t; \ (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \ $(PERL) -- $(srcdir)/help2man \ --include=$(srcdir)/$*.x \ --output=$t/$@ $t/$* \ --info-page="coreutils $*" @sed 's|$*\.td/||g' $t/$@ > $@ @chmod a-w $@ @rm -rf $t The neccessary parameter is: --info-page="coreutils $*" That way the man-page clearly state the command to type as: info coreutils without the need to name each command inside the info/dir file explicitely. E.g.: my info entry looks like this: * Coreutils: (coreutils). Core GNU utilities (v5.2.1). But there is *no* entry like that: * dd: (coreutils)dd invocation. Copy and convert a file. Typing `info dd' results in an error message, that info can't find an entry for `dd', but calling it `info coreutils dd' info knows to open the coreutils info file and looking up the dd command there, which succeeds. > > · factor: > > it's increddible - your factor command is *not* able to factorize negative > > values > > Patches would we welcome here. #include void factor( signed int num, ...) { switch ( num) { case 0: printf( "0:\n"); return ; case 1: case -1: printf( "%d: %d\n", num, num); return ; case INT_MIN: printf( "%d: -1 2 ", num); /* INT_MIN is *always* even */ num= 1 << ( sizeof( num)* CHAR_BIT- 2); break; default: printf( "%d: ", num); if ( num < 0) { printf( "-1 "); num= -num; } break; } /* factorize as usual */ ... } BTW, wouldn't it be correct to write 1: 1 instead of 1: as 1 can be factorized by itself? > > · NEWS: > > why is the above bug, which I reported, *not* listed within the NEWS file, > > clearly stated as a fixed bug? > > NEWS reports only important user-visible fixes. I don't know which > bug you meant by "the above bug". If we forgot to put a bugfix in > NEWS and it's important please tell it what it was. IMHO it's an important user-visible bugfix, if the stat command doesn't state success if it fails to stat a file, e.g. I found this problem while extending my shell-script for burning CD's and I had to check the size for pre-built ISO-images instead of creating them on the fly: fsize="`stat -c '%s' \"$fname\"`" || fail "unable to stat file \´$fname'" But as the stat command delivers success the value of fsize is not a number, so I had to work around this problem by prepending: [ ! -e "$fname" ] && fail "unable to stat \`$fname'" fsize="`stat -c '%s' \"$fname\"`" But even here there is a chance, that the stat command may fail - so I'm sure you'll see the user-visiblity of this specific bugfix now? > > · performance of the dd command: > > the execution speed of dd sucks heavily, > > Can you give a specific example of the problem? A shell transcript > would help. #!/bin/bash -f # mstart -> mend == msize mstart=70628 mend=57910964 msize=$[ $mend- $mstart] fname=The-Chubb-Chubbs.352x288.mpeg.avi echo "dd bs=1c count=$mstart if=$fname of=z.0" dd bs=1c count=$mstart if=$fname of=z.0 echo "dd bs=1c skip=$mend if=$fname of=z.N" dd bs=1c skip=$mend if=$fname of=z.N # dd: 2:45 minutes (v5.2.1) # dd: 2:50 minutes (v5.3.0) echo "dd ibs=1c obs=32k skip=$mstart count=$msize if=$fname of=z.mpeg" dd ibs=1c obs=32k skip=$mstart count=$msize if=$fname of=z.mpeg # sdd: 1:03 minutes echo "sdd ibs=1 obs=32k iseek=$mstart count=$msize if=$fname of=z.mpeg" sdd ibs=1 obs=32k iseek=$mstart count=$msize if=$fname of=z.mpeg The above file is an award winning short movie in 2003 taken from Sony's home-page, although I don't know the actual link anymore - sorry for that. The offsets are only true for the german version of this movie. The AVI file is in CD-XA format and the task is to extract the mpeg movie stream out of this container. Even though sdd is slow too in this case, it's faster than dd. To give you a clue - a quick and dirty C hack needs less than 4 seconds to extract the 57 MB mpeg stream (the last dd invocation), working with 32 kB buffers (this size performs best for my old SCSI drives). At least for me there are several tasks, where I need to extract some portions out of the middle of some bigger file and especially in this case dd (and even sdd) is very slow, as there is no other way - at least I see no combination of options, which does the same - to perform this task with dd. The time-consuming task for dd is, that the input stream will be fetched one byte at a time, although it could be fetched in larger chunks, after the initial seek into file (if it's seekable, of course) has been done. A solution might be to classify the input stream in order to detect, if it's a special device, where it must be fetched one byte at a time, and otherwise larger chunks could be read to speed this common case up? > Thanks again for your comments. (Though we don't really need to know > about your sex life....) Yeah I know... ;-) But it's my way to tell people, that there are many other pleasurable things to me like re-compling my complete system again and again... I'm sure you know exactly, what I want to say. BTW, before I forget - I'd like to suggest an extention to the expr command: it would be nice, if expr could handle the C shifting operators `<<' and `>>' as well as the ternary opertor `? :'... But there might be a chance, that POSIX says something different... THX for listening. CU Tom. (Thomas M.Ott) Germany From MAILER-DAEMON Thu Sep 29 12:06:16 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL0vH-0002fq-PV for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:06:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL0v5-0002b0-7d for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:06:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL0uy-0002W3-D4 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL0uw-0002OC-RD for bug-coreutils@gnu.org; Thu, 29 Sep 2005 12:05:54 -0400 Received: from [216.17.153.58] (helo=joseki.proulx.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL0mS-0004ck-9z for bug-coreutils@gnu.org; Thu, 29 Sep 2005 11:57:08 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 3531D4B3A2; Thu, 29 Sep 2005 09:57:07 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 2DDC815BC4C; Thu, 29 Sep 2005 09:57:07 -0600 (MDT) Date: Thu, 29 Sep 2005 09:57:07 -0600 To: bug-coreutils@gnu.org Message-ID: <20050929155707.GH31793@dementia.proulx.com> Mail-Followup-To: bug-coreutils@gnu.org, ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <20050929050021.GA31421@dementia.proulx.com> <87ek78fklx.fsf@rho.meyering.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ek78fklx.fsf@rho.meyering.net> User-Agent: Mutt/1.5.9i From: bob@proulx.com (Bob Proulx) Cc: ThMO Subject: Re: Re2: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 16:06:13 -0000 Jim Meyering wrote: > I've added this: > > stat now exits nonzero if a file operand does not exist Very good! Thanks Bob From MAILER-DAEMON Thu Sep 29 13:18:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL23f-0000q3-3E for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:18:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL23b-0000oI-D7 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:18:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL23a-0000nM-5a for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:18:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL22p-0008Um-Gx; Thu, 29 Sep 2005 13:18:07 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL1ed-0000bz-Cn; Thu, 29 Sep 2005 12:53:07 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8TGqv416730; Thu, 29 Sep 2005 09:52:57 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL1eT-00069W-6Y; Thu, 29 Sep 2005 09:52:57 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> From: Paul Eggert Date: Thu, 29 Sep 2005 09:52:57 -0700 In-Reply-To: <433C1085.EE7C84F5@gmx.de> (thmo-13@gmx.de's message of "Thu, 29 Sep 2005 18:04:21 +0200") Message-ID: <87irwj6ck6.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-gnulib@gnu.org, bug-coreutils@gnu.org Subject: Re: Re3: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 17:18:56 -0000 ThMO writes: > the header file xtime.h defines: > # if HAVE_LONG_LONG > typedef long long int xtime_t; > # define XTIME_PRECISION 1000000000LL > # else > ... > #endif > Again cpp groks about the `LL' modifier. Thanks for catching that portability problem to GCC 2.7.2.1. Please try the following patch, which I have installed into coreutils and gnulib CVS. I have manually verified that no other code cares whether XTIME_PRECISION is of type int or long long int. 2005-09-29 Paul Eggert * xtime.h (XTIME_PRECISION): Now of type int, not long long int, so that the code works even with ancient cpp. Portability problem with GCC 2.7.2.1 reported by Thomas M.Ott. --- xtime.h 14 May 2005 08:03:44 -0000 1.3 +++ xtime.h 29 Sep 2005 16:51:40 -0000 1.4 @@ -27,14 +27,14 @@ seconds. */ # if HAVE_LONG_LONG typedef long long int xtime_t; -# define XTIME_PRECISION 1000000000LL +# define XTIME_PRECISION 1000000000 # else # include typedef long int xtime_t; # if LONG_MAX >> 31 >> 31 == 0 -# define XTIME_PRECISION 1L +# define XTIME_PRECISION 1 # else -# define XTIME_PRECISION 1000000000L +# define XTIME_PRECISION 1000000000 # endif # endif From MAILER-DAEMON Thu Sep 29 13:39:58 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL2Nx-0000o0-CV for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL2Ns-0000lL-5h for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL2Nm-0000iJ-DU for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL2Nm-0000hj-7K for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:46 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL2Mr-0004Ef-Fp for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:38:49 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8THcZ420438; Thu, 29 Sep 2005 10:38:36 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL2Md-0007sV-Gc; Thu, 29 Sep 2005 10:38:35 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> From: Paul Eggert Date: Thu, 29 Sep 2005 10:38:35 -0700 In-Reply-To: <433C1085.EE7C84F5@gmx.de> (thmo-13@gmx.de's message of "Thu, 29 Sep 2005 18:04:21 +0200") Message-ID: <87achv6ag4.fsf_-_@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: coreutils man pages "info sort" -> "info coreutils sort" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 17:39:55 -0000 ThMO writes: > The neccessary parameter is: --info-page="coreutils $*" > That way the man-page clearly state the command to type as: > info coreutils > without the need to name each command inside the info/dir file explicitely. Thanks for the suggestion. So, I take it that you'd favor a patch like the following? This looks good to me. Jim, what do you think? 2005-09-29 Paul Eggert * man/Makefile.am (.x.1): Have the sort man page suggest "info coreutils sort" rather than "info sort", and similarly for the other man pages. Suggested by --- man/Makefile.am 5 Apr 2005 22:21:14 -0000 1.38 +++ man/Makefile.am 29 Sep 2005 17:36:04 -0000 @@ -131,6 +131,7 @@ mapped_name = `echo $*|sed 's/install/gi (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \ $(PERL) -- $(srcdir)/help2man \ --include=$(srcdir)/$*.x \ + --info-page='coreutils $*' \ --output=$t/$@ $t/$* @sed 's|$*\.td/||g' $t/$@ > $@ @chmod a-w $@ From MAILER-DAEMON Thu Sep 29 13:39:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL2Nz-0000pX-3s for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL2Nt-0000ly-2s for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL2Np-0000jn-Od for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL2Nn-0000hj-W9 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:39:48 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL2Jl-00046M-6i for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:35:37 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8THZW420101; Thu, 29 Sep 2005 10:35:33 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL2Jg-0007sK-Or; Thu, 29 Sep 2005 10:35:32 -0700 To: Jim Meyering References: <87achwc8tv.fsf@rho.meyering.net> From: Paul Eggert Date: Thu, 29 Sep 2005 10:35:32 -0700 In-Reply-To: <87achwc8tv.fsf@rho.meyering.net> (Jim Meyering's message of "Thu, 29 Sep 2005 15:17:00 +0200") Message-ID: <87br2b6al7.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: FYI: settime.c doesn't compile on OSF1 V5.1 due to stime X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 17:39:56 -0000 Jim Meyering writes: > +#elif HAVE_STIME > + { > + /* This fails to compile on OSF1 V5.1, due to stime requiring > + a `long int*' and tv_sec is `int'. But that system does provide > + settimeofday. */ > + int r = stime (&ts->tv_sec); > + if (r == 0 || errno == EPERM) > + return r; > #endif That can't work, as it has unbalanced {. Also, it's probably better just to return whatever error number stime and/or settimeofday return, rather than overwriting it with ENOSYS. I installed the further patch enclosed below. However, I'm curious: if settime had this problem, why don't all the other places that take the address of tv_sec? For example, date.c says "localtime (&when.tv_sec)". So time_t is int but stime takes a long int *? Does this have something to do with OSF1 having both 64-bit and 32-bit times? And settime is available only in the 64-bit flavor? If so, is it possible to cajole OSF1 into using a 64-bit time_t type everywhere, instead of using it only with settime? That would be better. 2005-09-29 Paul Eggert * settime.c (settime): Fix { typo in previous patch. Also, don't bother returning ENOSYS if settimeofday or stime fails; just let them return whatever errno they want to return. --- settime.c 29 Sep 2005 13:13:49 -0000 1.7 +++ settime.c 29 Sep 2005 17:21:44 -0000 1.9 @@ -53,24 +53,18 @@ settime (struct timespec const *ts) #if HAVE_SETTIMEOFDAY { struct timeval tv; - int r; tv.tv_sec = ts->tv_sec; tv.tv_usec = ts->tv_nsec / 1000; - r = settimeofday (&tv, 0); - if (r == 0 || errno == EPERM) - return r; + return settimeofday (&tv, 0); } #elif HAVE_STIME - { - /* This fails to compile on OSF1 V5.1, due to stime requiring - a `long int*' and tv_sec is `int'. But that system does provide - settimeofday. */ - int r = stime (&ts->tv_sec); - if (r == 0 || errno == EPERM) - return r; -#endif - + /* This fails to compile on OSF1 V5.1, due to stime requiring + a `long int*' and tv_sec is `int'. But that system does provide + settimeofday. */ + return stime (&ts->tv_sec); +#else errno = ENOSYS; return -1; +#endif } From MAILER-DAEMON Thu Sep 29 14:05:32 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL2mh-0000rt-Rs for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:05:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL2lb-0000U4-N0 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL2lT-0000ND-Ba for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL2lQ-0000Ec-N7 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:12 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL2dC-0005Qx-33 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:55:42 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id E46E484E8; Thu, 29 Sep 2005 19:55:40 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87br2b6al7.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Thu, 29 Sep 2005 10:35:32 -0700") References: <87achwc8tv.fsf@rho.meyering.net> <87br2b6al7.fsf@penguin.cs.ucla.edu> Date: Thu, 29 Sep 2005 19:55:40 +0200 Message-ID: <87zmpvahcz.fsf@rho.meyering.net> Lines: 32 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: FYI: settime.c doesn't compile on OSF1 V5.1 due to stime X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:05:30 -0000 Paul Eggert wrote: > That can't work, as it has unbalanced {. Also, it's probably better Thanks for catching that. BTW, do you know what (if any) system ends up using that HAVE_STIME block? I did run test builds on lots of systems, and none failed. > just to return whatever error number stime and/or settimeofday return, > rather than overwriting it with ENOSYS. I installed the further patch > enclosed below. > > However, I'm curious: if settime had this problem, why don't all the > other places that take the address of tv_sec? For example, date.c > says "localtime (&when.tv_sec)". So time_t is int but stime takes a > long int *? Right. Ugly. > Does this have something to do with OSF1 having both 64-bit and 32-bit > times? And settime is available only in the 64-bit flavor? If so, is > it possible to cajole OSF1 into using a 64-bit time_t type everywhere, > instead of using it only with settime? That would be better. It does have options to switch between 32 and 64-bit modes, but I didn't think it'd be worthwhile, for code that might never be used. > 2005-09-29 Paul Eggert > > * settime.c (settime): Fix { typo in previous patch. Also, don't > bother returning ENOSYS if settimeofday or stime fails; just let > them return whatever errno they want to return. From MAILER-DAEMON Thu Sep 29 14:05:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL2mm-0000tb-F6 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:05:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL2lb-0000U1-Mw for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL2lU-0000PJ-0e for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:21 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL2lT-0000Ec-Ky for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:04:15 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL2Xw-0005BC-N2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 13:50:16 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 6D90B84E8; Thu, 29 Sep 2005 19:50:15 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <87achv6ag4.fsf_-_@penguin.cs.ucla.edu> (Paul Eggert's message of "Thu, 29 Sep 2005 10:38:35 -0700") References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <87achv6ag4.fsf_-_@penguin.cs.ucla.edu> Date: Thu, 29 Sep 2005 19:50:15 +0200 Message-ID: <8764sjbw6g.fsf@rho.meyering.net> Lines: 29 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ThMO , bug-coreutils@gnu.org Subject: Re: coreutils man pages "info sort" -> "info coreutils sort" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:05:33 -0000 Paul Eggert wrote: > ThMO writes: > >> The neccessary parameter is: --info-page="coreutils $*" >> That way the man-page clearly state the command to type as: >> info coreutils >> without the need to name each command inside the info/dir file explicitely. > > Thanks for the suggestion. So, I take it that you'd favor a patch > like the following? This looks good to me. > > Jim, what do you think? We've been around the block a few times with Debian, trying to do just that, but there's at least one problem: `info coreutils pr' would display the `printing text' section of the manual, not the one on `pr invocation'. See the ChangeLog for man/Makefile.am for more details. However, if we can fix `info' to do the right thing, then I'd be happy to change it. > 2005-09-29 Paul Eggert > > * man/Makefile.am (.x.1): Have the sort man page suggest "info > coreutils sort" rather than "info sort", and similarly for the > other man pages. Suggested by From MAILER-DAEMON Thu Sep 29 14:18:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL2yg-0005Fq-Uf for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:17:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL2ya-0005Ch-JA for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:17:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL2yU-00059O-T2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:17:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL2yU-00058Y-Fs for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:17:42 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EL2u3-0006ld-6N for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:13:07 -0400 Received: (qmail invoked by alias); 29 Sep 2005 18:06:25 -0000 Received: from dialin-145-254-244-111.arcor-ip.net (EHLO thommy.koffer.de) [145.254.244.111] by mail.gmx.net (mp033) with SMTP; 29 Sep 2005 20:06:25 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id UAA15146; Thu, 29 Sep 2005 20:05:34 +0200 Sender: root@thommy.koffer.de Message-ID: <433C2CEE.D60D85B1@gmx.de> Date: Thu, 29 Sep 2005 20:05:34 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: Paul Eggert References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <87irwj6ck6.fsf@penguin.cs.ucla.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: bug-gnulib@gnu.org, bug-coreutils@gnu.org Subject: Re4: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:17:52 -0000 Hello Paul, > > the header file xtime.h defines: > > # if HAVE_LONG_LONG > > typedef long long int xtime_t; > > # define XTIME_PRECISION 1000000000LL > > # else > > ... > > #endif > > Again cpp groks about the `LL' modifier. > > Thanks for catching that portability problem to GCC 2.7.2.1. Please > try the following patch, which I have installed into coreutils and > gnulib CVS. I have manually verified that no other code cares whether > XTIME_PRECISION is of type int or long long int. I do have a shorter patch for you: --- coreutils-5.3.1-cvs/lib/xtime.h.orig 2005-05-14 10:03:44.000000000 +0200 +++ coreutils-5.3.1-cvs/lib/xtime.h 2005-09-29 19:51:50.000000000 +0200 @@ -27,7 +27,7 @@ seconds. */ # if HAVE_LONG_LONG typedef long long int xtime_t; -# define XTIME_PRECISION 1000000000LL +# define XTIME_PRECISION 1000000000L # else # include typedef long int xtime_t; This older cpp still is able to handle longs, but not long longs - even though the compiler can handle it. With both patches the stuff compiles cleanly. THX for listening. CU Tom. (Thomas M.Ott) Germany From MAILER-DAEMON Thu Sep 29 14:31:29 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL3Bm-0001Eo-Oe for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3Bc-00015E-Mt for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3BT-0000xx-HC for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3BT-0000x8-A2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:07 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EL38l-0007kk-SX for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:28:20 -0400 Received: (qmail invoked by alias); 29 Sep 2005 18:28:18 -0000 Received: from dialin-145-254-244-188.arcor-ip.net (EHLO thommy.koffer.de) [145.254.244.188] by mail.gmx.net (mp035) with SMTP; 29 Sep 2005 20:28:18 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id UAA15248; Thu, 29 Sep 2005 20:27:09 +0200 Sender: root@thommy.koffer.de Message-ID: <433C31FD.B2AE625D@gmx.de> Date: Thu, 29 Sep 2005 20:27:09 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: Jim Meyering References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <87achv6ag4.fsf_-_@penguin.cs.ucla.edu> <8764sjbw6g.fsf@rho.meyering.net> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 Cc: Paul Eggert , bug-coreutils@gnu.org Subject: Re: coreutils man pages "info sort" -> "info coreutils sort" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:31:23 -0000 Hello Jim, Paul and others listening, > [...] > > Jim, what do you think? > > We've been around the block a few times with Debian, > trying to do just that, but there's at least one problem: > > `info coreutils pr' would display the `printing text' > section of the manual, not the one on `pr invocation'. > > See the ChangeLog for man/Makefile.am for more details. > > However, if we can fix `info' to do the right thing, > then I'd be happy to change it. aah, now I see the "problem" - I guess it would be difficult for info to sort out, what the user meant, so info looks for an exact match, and if none is found looks for the *1st* menu entry, which starts with the given prefix - as the menu entry ``printing text'' comes long before ``pr invocation'' info selects the first match. There are several ways to come up with this: · info coreutils 'pr ' the blank is important here, so info selects the wanted menu item · resorting the menu items, so ``pr invocation'' comes before ``printing text'' · hacking an ugly shell-wrapper :) THX for listening. CU Tom. (Thomas M.Ott) Germany From MAILER-DAEMON Thu Sep 29 14:33:03 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL3Bq-0001Hi-4u for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3Bc-00015C-KS for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3BT-0000yA-UO for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3BT-0000x8-H6 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:07 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EL38j-0007kY-Sk for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:28:18 -0400 Received: (qmail invoked by alias); 29 Sep 2005 18:28:16 -0000 Received: from dialin-145-254-244-188.arcor-ip.net (EHLO thommy.koffer.de) [145.254.244.188] by mail.gmx.net (mp035) with SMTP; 29 Sep 2005 20:28:16 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id UAA15237; Thu, 29 Sep 2005 20:17:39 +0200 Sender: root@thommy.koffer.de Message-ID: <433C2FC3.76A2048E@gmx.de> Date: Thu, 29 Sep 2005 20:17:39 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: Paul Eggert References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <87achv6ag4.fsf_-_@penguin.cs.ucla.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: bug-coreutils@gnu.org Subject: Re: coreutils man pages "info sort" -> "info coreutils sort" X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:31:25 -0000 Hello Paul and others listening, > > The neccessary parameter is: --info-page="coreutils $*" > > That way the man-page clearly state the command to type as: > > info coreutils > > without the need to name each command inside the info/dir file explicitely. > > Thanks for the suggestion. So, I take it that you'd favor a patch > like the following? This looks good to me. I had a close look at v5.2.1 - interestingly the rule to convert the help output to a man-page had this parameter already... THX for listening. CU Tom. (Thomas M.Ott) Germany From MAILER-DAEMON Thu Sep 29 14:38:19 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL3IQ-0002qN-Cc for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:38:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3IN-0002ne-KX for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:38:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3IL-0002m8-VT for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:38:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3IL-0002jr-Li for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:38:13 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL3F4-0008Uy-R3 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:34:51 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 016043B8; Thu, 29 Sep 2005 20:34:49 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26667; Thu, 29 Sep 05 20:34:35 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 7C21026A for ; Thu, 29 Sep 2005 20:34:35 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 608D444004 for ; Thu, 29 Sep 2005 20:34:35 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13497-01-11 for ; Thu, 29 Sep 2005 20:34:34 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id D4F1644003 for ; Thu, 29 Sep 2005 20:34:34 +0200 (CEST) Received: (nullmailer pid 2319 invoked by uid 30270); Thu, 29 Sep 2005 18:34:34 -0000 From: "Alfred M\. Szmidt" To: bug-coreutils@gnu.org Date: Thu, 29 Sep 2005 20:34:34 +0200 Message-Id: <1128018874.750246.2318.nullmailer@Update.UU.SE> Subject: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:38:16 -0000 I'm pondering about implementing pkill like functionality in kill, instead of introducing a new command specific for the purpose. My idea is basicly to make `kill' accept a name instead of just a pid, so the command would look something like: kill [-s SIG | -SIGNAL] PID | NAME Personally, I think this makes more sense than introducing pkill (or for that matter, killall). And is cleaner. What do people think about this? (Note, I'm only pondering about it, I don't know when I'll get about implementing it, I was also pondering about doing something similar to GNU ps (it is in the Hurd), where you could specify something like `ps --match-name=NAME') From MAILER-DAEMON Thu Sep 29 15:02:12 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL3fX-0001AN-P6 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:02:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3ec-00016l-PM for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3eT-00013T-It for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3eT-0000vl-HG for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:05 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL3Ql-0000ky-7d for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:46:55 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8TIkm427347; Thu, 29 Sep 2005 11:46:48 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL3Qe-0007vo-Fj; Thu, 29 Sep 2005 11:46:48 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> From: Paul Eggert Date: Thu, 29 Sep 2005 11:46:48 -0700 In-Reply-To: <433C1085.EE7C84F5@gmx.de> (thmo-13@gmx.de's message of "Thu, 29 Sep 2005 18:04:21 +0200") Message-ID: <871x3767af.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: Re3: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 19:02:09 -0000 ThMO writes: >> > =C2=B7 lib/getdate.y: >> > I'm using bison v1.28 - and for me it's unacceptable, that this gram= mar >> > can't be processed corrrectly with this older version, >>=20 >> You shouldn't need to process it at all, since getdate.c is present in >> the source distribution. Perhaps the time stamps on your files were >> corrupted? > > No, I always reproduce every generated files... Then you'll need to have an up-to-date Bison. Bison 2.1 is the current stable version. The general rule with coreutils (as with many other GNU packages) is that if you want act like a maintainer, you need the latest stable maintainer's tools. If you merely want to compile and install, then the rules are relaxed and the code is buildable with a much wider variety of tools. > In the meanwhile I tried out bison v2.1, but wasn't successful with some > grammar files, where I had to stuff together three SQL-select parsers usi= ng > one flex-scanner and therefore had to, maybe misuse the C pre-processor, = so > I'll stick to my old version locally. Please report any compatibility issues to . In the meantime you can install both versions of Bison in different locations, and use Bison 2.1 when building GNU software from scratch. >> > =C2=B7 factor: >> > it's increddible - your factor command is *not* able to factorize ne= gative >> > values >>=20 >> Patches would we welcome here. > > #include > ... Sorry, I should have been clearer. By "patch" I meant the output of "diff -pu" for all the files you changed, along with ChangeLog entries appropriate for each file. We should be able to take the existing source code, apply your patch by using "patch -p0", and then do a "make check" and everything should work just fine. You can see an example patch here: . Typically the hardest part of writing a patch is the documentation. Then the test cases. The source code is the easiest. > wouldn't it be correct to write > 1: 1 > instead of > 1: > as 1 can be factorized by itself? The output always omits "1". This is longstanding tradition: I wouldn't want to change it. "factor" should probably diagnose any attempts to factor 0, since it's not consistent that 0 and 1 have the same reported factors. Solaris 10 "factor" (which uses a different output format) exits if you try to factor 0. > IMHO it's an important user-visible bugfix, Thanks. It's in NEWS now. > Even though sdd is slow too in this case, it's faster than dd. Can you use the strace command to characterize why that would be? What is sdd doing that makes it run so much faster on your host? (I'm afraid you'll have to help us out here, as we don't have your hardware.) > The time-consuming task for dd is, that the input stream will be fetched > one byte at a time, although it could be fetched in larger chunks, after = the > initial seek into file (if it's seekable, of course) has been done. Can't you do something like this? (# Do the initial seek dd bs=3D1 count=3D0 seek=3D37 && # Copy files in larger chunks dd bs=3D8192 count=3D100000) output (of course substituting your own values for 37, 8192, and 100000). > BTW, before I forget - I'd like to suggest an extention to the expr comma= nd: > it would be nice, if expr could handle the C shifting operators `<<' and = `>>' > as well as the ternary opertor `? :'... > But there might be a chance, that POSIX says something different... POSIX says that "<<", ">>", and "?" must be treated as valid string operands, and that ":" is an infix operator meaning string matching, so it'd be tricky to add these without violating POSIX. For example "expr '?' : '>>'" must output "0". I suspect that ?: would run afoul of :. I suspect "<<" and ">>" could be done (as well as ~, ^, !), but it'd have to be checked carefully for compatibility. Maybe ?: could be added under a different syntax (along with | and &, presumably), under the same rules as << etc., but the different spellings would be confusing. Given all these hassles, I think it's better to ask people to use $((...)), as that's more portable (it's been standardized as part of POSIX) than extensions to expr would be. expr really is for backwards compatibility only. From MAILER-DAEMON Thu Sep 29 15:04:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL3hW-0001yn-W7 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:04:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3el-00017b-04 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3eU-00014M-UE for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3eU-0000vl-PL for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:01:06 -0400 Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL3Ly-0000as-EP; Thu, 29 Sep 2005 14:41:58 -0400 Received: by colibri.its.uu.se (Postfix, from userid 211) id 7E0AF6AE; Thu, 29 Sep 2005 20:41:57 +0200 (DFT) Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14347; Thu, 29 Sep 05 20:41:51 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id 4B586684; Thu, 29 Sep 2005 20:41:51 +0200 (DFT) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 3878A44004; Thu, 29 Sep 2005 20:41:51 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26453-03-3; Thu, 29 Sep 2005 20:41:50 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id A871E44003; Thu, 29 Sep 2005 20:41:50 +0200 (CEST) Received: (nullmailer pid 2341 invoked by uid 30270); Thu, 29 Sep 2005 18:41:50 -0000 From: "Alfred M\. Szmidt" To: ams@gnu.org In-reply-to: <1128018874.750246.2318.nullmailer@Update.UU.SE> (ams@gnu.org) References: <1128018874.750246.2318.nullmailer@Update.UU.SE> Date: Thu, 29 Sep 2005 20:41:50 +0200 Message-Id: <1128019310.517855.2340.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 19:04:14 -0000 Actually, scratch that, pkill/pgrep can be implemented in a trivial shell script. Which is far cleaner than adding the functionality of grep to kill (or ps). From MAILER-DAEMON Thu Sep 29 15:45:25 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL4LL-0003EK-O0 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL4L4-00037V-M4 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL4Ky-00033d-Ru for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL4Ky-0002q4-8C for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:00 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL47Q-0003Q6-5Q; Thu, 29 Sep 2005 15:31:00 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8TJUv424601; Thu, 29 Sep 2005 12:30:58 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL47N-0007xT-U2; Thu, 29 Sep 2005 12:30:57 -0700 To: ams@gnu.org References: <1128018874.750246.2318.nullmailer@Update.UU.SE> From: Paul Eggert Date: Thu, 29 Sep 2005 12:30:57 -0700 In-Reply-To: <1128018874.750246.2318.nullmailer@Update.UU.SE> (Alfred M. Szmidt's message of "Thu, 29 Sep 2005 20:34:34 +0200") Message-ID: <87fyrn4qoe.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 19:45:14 -0000 "Alfred M\. Szmidt" writes: > kill [-s SIG | -SIGNAL] PID | NAME > > Personally, I think this makes more sense than introducing pkill (or > for that matter, killall). And is cleaner. What do people think > about this? Most people use the builtin kill command of the shell, so you'll have to change Bash as well as coreutils. If the program's name is actually a number, the syntax would be ambiguous. Presumably you could have a --match-name option for these rare, ambiguous cases. >From a coreutils point of view, there'd be a lot of code to add, since you need the functionality of "ps", which is not in coreutils now. From MAILER-DAEMON Thu Sep 29 15:46:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL4MY-0003nZ-Ix for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:46:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL4MH-0003it-Hp for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:46:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL4Lk-0003RG-Te for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL4Lg-0003IC-KC for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:45:46 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL40p-0002yp-8c for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:24:11 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8TJO7423925; Thu, 29 Sep 2005 12:24:07 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL40l-0007xK-Lh; Thu, 29 Sep 2005 12:24:07 -0700 To: Jim Meyering References: <87achwc8tv.fsf@rho.meyering.net> <87br2b6al7.fsf@penguin.cs.ucla.edu> <87zmpvahcz.fsf@rho.meyering.net> From: Paul Eggert Date: Thu, 29 Sep 2005 12:24:07 -0700 In-Reply-To: <87zmpvahcz.fsf@rho.meyering.net> (Jim Meyering's message of "Thu, 29 Sep 2005 19:55:40 +0200") Message-ID: <87k6gz4qzs.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: FYI: settime.c doesn't compile on OSF1 V5.1 due to stime X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 19:46:36 -0000 Jim Meyering writes: > [OSF1] does have options to switch between 32 and 64-bit modes, > but I didn't think it'd be worthwhile, for code that might > never be used. Yes, but I'm more worried about date, ls, etc. These all use time_t, and if OSF1 can be cajoled into using 64-bit time_t then that would be a win for them. I'm not worried much about OSF1 (it's pretty much dead) but if Tru64 has the same problem it's worth addressing. Casper H.S. Dik wrote "You can #define something and it will give you 64-bit time_t on Tru64, but it's still 32-bit by default." . All we need to do is find out what that #define symbol is, and #define it in config.h. Presumably we can discover what the symbol is by looking in a Tru64 and looking for ifdefs. > BTW, do you know what (if any) system ends up using that HAVE_STIME block? System V hosts that lack BSD extensions. There's not many left these days. POSIX has required gettimeofday since 2001, and settimeofday usually comes along with it. Google Groups reports that Dynix 4.2 (circa 1997) lacked gettimeofday and that SCO 3.2.4.2 (circa 1996) also lacked it . From MAILER-DAEMON Thu Sep 29 15:48:37 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL4OT-0004Zq-6f for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:48:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL4OR-0004Yb-4O for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:48:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL4OQ-0004Y7-DL for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:48:34 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL4M0-0003IC-KD; Thu, 29 Sep 2005 15:46:04 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL3la-0002Lb-TW; Thu, 29 Sep 2005 15:08:27 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8TJ8N414148; Thu, 29 Sep 2005 12:08:23 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1EL3lX-0007wq-Ml; Thu, 29 Sep 2005 12:08:23 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <87irwj6ck6.fsf@penguin.cs.ucla.edu> <433C2CEE.D60D85B1@gmx.de> From: Paul Eggert Date: Thu, 29 Sep 2005 12:08:23 -0700 In-Reply-To: <433C2CEE.D60D85B1@gmx.de> (thmo-13@gmx.de's message of "Thu, 29 Sep 2005 20:05:34 +0200") Message-ID: <87oe6b4rq0.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-gnulib@gnu.org, bug-coreutils@gnu.org Subject: Re: Re4: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 19:48:35 -0000 ThMO writes: > I do have a shorter patch for you: > ... > -# define XTIME_PRECISION 1000000000LL > +# define XTIME_PRECISION 1000000000L Thanks, but if XTIME_PRECISION can't be of the correct type, I'd rather just make it 'int' on all platforms and be done with it. > With both patches the stuff compiles cleanly. Thanks for checking the longer patch. From MAILER-DAEMON Thu Sep 29 16:03:15 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL4cc-0002WJ-KQ for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 16:03:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL4cV-0002Sh-DU for bug-coreutils@gnu.org; Thu, 29 Sep 2005 16:03:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL4cL-0002Mm-Ee for bug-coreutils@gnu.org; Thu, 29 Sep 2005 16:02:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL4cK-0002Jf-6z for bug-coreutils@gnu.org; Thu, 29 Sep 2005 16:02:56 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL4XH-0005SX-BK for bug-coreutils@gnu.org; Thu, 29 Sep 2005 15:57:43 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 451EC465; Thu, 29 Sep 2005 21:57:42 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26658; Thu, 29 Sep 05 21:57:36 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 1ED512BD; Thu, 29 Sep 2005 21:57:35 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id CFAAF44004; Thu, 29 Sep 2005 21:57:35 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14196-02-28; Thu, 29 Sep 2005 21:57:35 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 3583D44003; Thu, 29 Sep 2005 21:57:35 +0200 (CEST) Received: (nullmailer pid 2463 invoked by uid 30270); Thu, 29 Sep 2005 19:57:35 -0000 From: "Alfred M\. Szmidt" To: Paul Eggert In-reply-to: <87fyrn4qoe.fsf@penguin.cs.ucla.edu> (message from Paul Eggert on Thu, 29 Sep 2005 12:30:57 -0700) References: <1128018874.750246.2318.nullmailer@Update.UU.SE> <87fyrn4qoe.fsf@penguin.cs.ucla.edu> Date: Thu, 29 Sep 2005 21:57:35 +0200 Message-Id: <1128023855.102135.2462.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 20:03:13 -0000 Most people use the builtin kill command of the shell, so you'll have to change Bash as well as coreutils. I wish that bash would remove all those builtins, or only use them if a such a builtin doesn't exist on the system. If the program's name is actually a number, the syntax would be ambiguous. Presumably you could have a --match-name option for these rare, ambiguous cases. One could easily get around that by doing `kill SIG -- NAME' or something. From a coreutils point of view, there'd be a lot of code to add, since you need the functionality of "ps", which is not in coreutils now. Yeah, I looked at ps, and adding pgrep functionality there is easier. But then my mind started thinking that it would be nice to support proper regexpes, and I just hate C regexp support... From MAILER-DAEMON Thu Sep 29 17:23:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL5s3-0000hL-L6 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:23:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL5rx-0000eo-0B for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:23:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL5rm-0000Ys-CG for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:22:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL5rj-0000Ua-Me for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:22:55 -0400 Received: from [216.148.227.118] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL5k9-0002XA-Sk; Thu, 29 Sep 2005 17:15:06 -0400 Received: from 204.127.197.117 ([204.127.197.117]) by comcast.net (rwcrmhc13) with SMTP id <2005092921150401500rq0ide>; Thu, 29 Sep 2005 21:15:04 +0000 Received: from [128.170.36.44] by 204.127.197.117; Thu, 29 Sep 2005 21:15:04 +0000 From: ericblake@comcast.net (Eric Blake) To: ams@gnu.org Date: Thu, 29 Sep 2005 21:15:04 +0000 Message-Id: <092920052115.25571.433C59580002198D000063E322007340760A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 21:23:10 -0000 > Most people use the builtin kill command of the shell, so you'll > have to change Bash as well as coreutils. > > I wish that bash would remove all those builtins, or only use them if > a such a builtin doesn't exist on the system. bash has the enable builtin which lets you disable builtins: enable -n kill Also, since kill is not a special builtin, you can always do one of: alias kill=/bin/kill kill() { /bin/kill "$@" } Remember, POSIX requires kill(1) to be a shell builtin, because it must support job syntax ("kill %1", for example), which cannot be done with normal POSIX child process semantics. POSIX also requires kill(1) to be an external program, invocable by env, nice, xargs, etc. (it requires this of all non-special builtins), with the documented effect that when invoked externally, job syntax does not have to work. -- Eric Blake From MAILER-DAEMON Thu Sep 29 17:24:35 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL5tL-0001CQ-F3 for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:24:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL5tJ-0001Br-6X for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:24:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL5tH-0001B1-7Q for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:24:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL5tG-0001AU-Pe for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:24:30 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL5sA-00036d-BU for bug-coreutils@gnu.org; Thu, 29 Sep 2005 17:23:22 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 90C69269; Thu, 29 Sep 2005 23:23:21 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26650; Thu, 29 Sep 05 23:23:13 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id B6991269; Thu, 29 Sep 2005 23:23:13 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id 3084D44004; Thu, 29 Sep 2005 23:23:12 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17954-01-62; Thu, 29 Sep 2005 23:23:11 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 8968F44003; Thu, 29 Sep 2005 23:23:11 +0200 (CEST) Received: (nullmailer pid 2597 invoked by uid 30270); Thu, 29 Sep 2005 21:23:11 -0000 From: "Alfred M\. Szmidt" To: ericblake@comcast.net (Eric Blake) In-reply-to: <092920052115.25571.433C59580002198D000063E322007340760A050E040D0C079D0A@comcast.net> (ericblake@comcast.net) References: <092920052115.25571.433C59580002198D000063E322007340760A050E040D0C079D0A@comcast.net> Date: Thu, 29 Sep 2005 23:23:11 +0200 Message-Id: <1128028991.437830.2596.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 21:24:34 -0000 Remember, POSIX requires kill(1) to be a shell builtin, because it must support job syntax ("kill %1", for example), which cannot be done with normal POSIX child process semantics. In that case, one can make the builtin kill a wrapper, that parses the command line, and if it see %1 it replaces it with the process job pid and passes that to the real kill, or the builtin kill if no system kill utiltiy exists. Just cause POSIX says something, doesn't mean that it is right. From MAILER-DAEMON Thu Sep 29 18:11:44 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL6ct-0005s8-GX for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:11:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL6cl-0005oN-JD for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:11:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL6ci-0005mu-5T for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:11:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL6ch-0005hx-4M; Thu, 29 Sep 2005 18:11:27 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL6Tx-0005jr-DD; Thu, 29 Sep 2005 18:02:26 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 8D25614EC; Fri, 30 Sep 2005 00:02:24 +0200 (CEST) From: Jim Meyering To: info-gnu@gnu.org, coreutils-announce@gnu.org Date: Fri, 30 Sep 2005 00:02:02 +0200 Message-ID: <87irwja5yd.fsf@rho.meyering.net> Lines: 295 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: translation@iro.umontreal.ca, bug-coreutils@gnu.org Subject: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 22:11:35 -0000 --=-=-= The GNU coreutils package contains the following programs: [ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold ginstall groups head hostid hostname id join kill link ln logname ls md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir seq sha1sum shred sleep sort split stat stty su sum sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes The coreutils package replaces/unifies the fileutils, sh-utils, and textutils packages. There have been many changes since the last release (unstable 5.3.0). So many that I feel 5.90 should also be considered unstable, at least initially. As usual, special thanks go to Paul Eggert for his many contributions. Thanks to everyone else who contributed changes (attributions are in the ChangeLog files), reported problems, and helped by fielding questions on the mailing list. Here are the compressed sources: ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.90.tar.gz (7.1MB) ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.90.tar.bz2 (4.5MB) Here are the xdelta-style diffs: ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0-5.90.xdelta (1.8MB) Here are the GPG detached signatures: ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.90.tar.gz.sig ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.90.tar.bz2.sig Here are the MD5 and SHA1 checksums: 9483e5deb4b9217e2db96064508b1a43 coreutils-5.90.tar.gz 1314b50231da15a0fe49c26e7751d559 coreutils-5.90.tar.bz2 a108c185306c56dc8daea47d11d25fce coreutils-5.3.0-5.90.xdelta f23b16776db155c99891c8e2ed4a3b807fc78478 coreutils-5.90.tar.gz bcaf64732f2b7c06e273f793094f5dd322370c93 coreutils-5.90.tar.bz2 df19054a0eecb888d513710210e4ce551d1129db coreutils-5.3.0-5.90.xdelta ***************** How can you help? ***************** If you're interested in lending a hand, or just want to use the latest versions right now, you can build these programs and run the test suite like this: gzip -dc coreutils-5.90.tar.gz | tar xf - cd coreutils-5.90 ./configure make make -k check >& log grep FAIL log Be sure to use make's -k option so that make doesn't stop just because one of the earlier tests fails. Please report any build problems or test failures to the bug-coreutils@gnu.org mailing list. There are detailed instructions in the `Reporting bugs:' section of the README file. For further reading, see the coreutils home page http://www.gnu.org/software/coreutils/ and the FAQ list: http://www.gnu.org/software/coreutils/faq/ ***************** NEWS ***************** * Major changes in release 5.90 (2005-09-29) [unstable] ** Bring back support for `head -NUM', `tail -NUM', etc. even when conforming to POSIX 1003.1-2001. The following changes apply only when conforming to POSIX 1003.1-2001; there is no effect when conforming to older POSIX versions. The following usages now behave just as when conforming to older POSIX: date -I expand -TAB1[,TAB2,...] fold -WIDTH head -NUM join -j FIELD join -j1 FIELD join -j2 FIELD join -o FIELD_NAME1 FIELD_NAME2... nice -NUM od -w pr -S split -NUM tail -[NUM][bcl][f] [FILE] The following usages no longer work, due to the above changes: date -I TIMESPEC (use `date -ITIMESPEC' instead) od -w WIDTH (use `od -wWIDTH' instead) pr -S STRING (use `pr -SSTRING' instead) A few usages still have behavior that depends on which POSIX standard is being conformed to, and portable applications should beware these problematic usages. These include: Problematic Standard-conforming replacement, depending on usage whether you prefer the behavior of: POSIX 1003.2-1992 POSIX 1003.1-2001 sort +4 sort -k 5 sort ./+4 tail +4 tail -n +4 tail ./+4 tail - main.c tail main.c tail -- - main.c tail -c 4 tail -c 10 ./4 tail -c4 touch 12312359 f touch -t 12312359 f touch ./12312359 f uniq +4 uniq -s 4 uniq ./+4 These changes are in response to decisions taken in the January 2005 Austin Group standardization meeting. For more details, please see "Utility Syntax Guidelines" in the Minutes of the January 2005 Meeting . ** Binary input and output are now implemented more consistently. These changes affect only platforms like MS-DOS that distinguish between binary and text files. The following programs now always use text input/output: expand unexpand The following programs now always use binary input/output to copy data: cp install mv shred The following programs now always use binary input/output to copy data, except for stdin and stdout when it is a terminal. head tac tail tee tr (cat behaves similarly, unless one of the options -bensAE is used.) cat's --binary or -B option has been removed. It existed only on MS-DOS-like platforms, and didn't work as documented there. md5sum and sha1sum now obey the -b or --binary option, even if standard input is a terminal, and they no longer report files to be binary if they actually read them in text mode. ** Changes for better conformance to POSIX cp, ln, mv, rm changes: Leading white space is now significant in responses to yes-or-no questions. For example, if "rm" asks "remove regular file `foo'?" and you respond with " y" (i.e., space before "y"), it counts as "no". dd changes: On a QUIT or PIPE signal, dd now exits without printing statistics. On hosts lacking the INFO signal, dd no longer treats the USR1 signal as if it were INFO when POSIXLY_CORRECT is set. If the file F is non-seekable and contains fewer than N blocks, then before copying "dd seek=N of=F" now extends F with zeroed blocks until F contains N blocks. fold changes: When POSIXLY_CORRECT is set, "fold file -3" is now equivalent to "fold file ./-3", not the obviously-erroneous "fold file ./-w3". ls changes: -p now marks only directories; it is equivalent to the new option --indicator-style=slash. Use --file-type or --indicator-style=file-type to get -p's old behavior. nice changes: Documentation and diagnostics now refer to "nicenesses" (commonly in the range -20...19) rather than "nice values" (commonly 0...39). nohup changes: nohup now ignores the umask when creating nohup.out. nohup now closes stderr if it is a terminal and stdout is closed. nohup now exits with status 127 (not 1) when given an invalid option. pathchk changes: It now rejects the empty name in the normal case. That is, "pathchk -p ''" now fails, and "pathchk ''" fails unless the current host (contra POSIX) allows empty file names. The new -P option checks whether a file name component has leading "-", as suggested in interpretation "Austin-039:XCU:pathchk:pathchk -p" . It also rejects the empty name even if the current host accepts it; see . The --portability option is now equivalent to -p -P. ** Bug fixes chmod, mkdir, mkfifo, and mknod formerly mishandled rarely-used symbolic permissions like =xX and =u, and did not properly diagnose some invalid strings like g+gr, ug,+x, and +1. These bugs have been fixed. csplit could produce corrupt output, given input lines longer than 8KB dd now computes statistics using a realtime clock (if available) rather than the time-of-day clock, to avoid glitches if the time-of-day is changed while dd is running. Also, it avoids using unsafe code in signal handlers; this fixes some core dumps. expr and test now correctly compare integers of unlimited magnitude. expr now detects integer overflow when converting strings to integers, rather than silently wrapping around. ls now refuses to generate time stamps containing more than 1000 bytes, to foil potential denial-of-service attacks on hosts with very large stacks. "mkdir -m =+x dir" no longer ignores the umask when evaluating "+x", and similarly for mkfifo and mknod. "mkdir -p /tmp/a/b dir" no longer attempts to create the `.'-relative directory, dir (in /tmp/a), when, after creating /tmp/a/b, it is unable to return to its initial working directory. Similarly for "install -D file /tmp/a/b/file". "pr -D FORMAT" now accepts the same formats that "date +FORMAT" does. stat now exits nonzero if a file operand does not exist ** Improved robustness Date no longer needs to allocate virtual memory to do its job, so it can no longer fail due to an out-of-memory condition, no matter how large the result. ** Improved portability hostid now prints exactly 8 hexadecimal digits, possibly with leading zeros, and without any spurious leading "fff..." on 64-bit hosts. nice now works on Darwin 7.7.0 in spite of its invalid definition of NZERO. `rm -r' can remove all entries in a directory even when it is on a file system for which readdir is buggy and that was not checked by coreutils' old configure-time run-test. sleep no longer fails when resumed after being suspended on linux-2.6.8.1, in spite of that kernel's buggy nanosleep implementation. ** New features chmod -w now complains if its behavior differs from what chmod a-w would do, and similarly for chmod -r, chmod -x, etc. cp and mv: the --reply=X option is deprecated date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I) option is deprecated; it still works, but new applications should avoid it. date, du, ls, and pr's time formats now support new %:z, %::z, %:::z specifiers for numeric time zone offsets like -07:00, -07:00:00, and -07. dd has new iflag= and oflag= flags "binary" and "text", which have an effect only on nonstandard platforms that distinguish text from binary I/O. du accepts new options: --time[=TYPE] and --time-style=STYLE join now supports a NUL field separator, e.g., "join -t '\0'". join now detects and reports incompatible options, e.g., "join -t x -t y", ls no longer outputs an extra space between the mode and the link count when none of the listed files has an ACL. md5sum --check now accepts multiple input files, and similarly for sha1sum. If stdin is a terminal, nohup now redirects it from /dev/null to prevent the command from tying up an OpenSSH session after you logout. "rm -FOO" now suggests "rm ./-FOO" if the file "-FOO" exists and "-FOO" is not a valid option. stat -f -c %S outputs the fundamental block size (used for block counts). stat -f's default output format has been changed to output this size as well. stat -f recognizes file systems of type XFS and JFS "touch -" now touches standard output, not a file named "-". uname -a no longer generates the -p and -i outputs if they are unknown. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDPGRw/dLerNMzy6ERAlM7AJ9kawayvu5M6WxvqUA/iTp82wSA+QCeObBL oIq0Ctbj+LWCb1w5UX1PzGc= =+hMx -----END PGP SIGNATURE----- --=-=-=-- From MAILER-DAEMON Thu Sep 29 18:40:11 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL74T-0007fJ-Np for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:40:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL74G-0007Wr-Sr for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:39:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL74D-0007Ue-Hl for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:39:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL74D-0007TK-7M for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:39:53 -0400 Received: from [204.127.198.43] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL73m-0008Pe-FS; Thu, 29 Sep 2005 18:39:26 -0400 Received: from 204.127.197.111 (rmailcenter75.comcast.net[204.127.197.157]) by comcast.net (rwcrmhc12) with SMTP id <2005092922392401400ktobve>; Thu, 29 Sep 2005 22:39:25 +0000 Received: from [128.170.36.44] by 204.127.197.111; Thu, 29 Sep 2005 22:39:24 +0000 From: ericblake@comcast.net (Eric Blake) To: ams@gnu.org Date: Thu, 29 Sep 2005 22:39:24 +0000 Message-Id: <092920052239.575.433C6D1C0008A5630000023F22064246130A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 22:40:02 -0000 > Remember, POSIX requires kill(1) to be a shell builtin, because it > must support job syntax ("kill %1", for example), which cannot be > done with normal POSIX child process semantics. > > In that case, one can make the builtin kill a wrapper, that parses the > command line, and if it see %1 it replaces it with the process job pid > and passes that to the real kill, or the builtin kill if no system > kill utiltiy exists. Write your own shell function that does just that. You can use 'jobs -p' to find the process number. Something like this untested snippet (making it robust to arbitrary input and arbitrary number of arguments is left an exercise to the reader): kill() { arglist= for arg in "$*" ; do case $arg in %*) arglist="$arglist `jobs -p $arg`" ;; *) arglist="$arglist $arg" ;; esac done test -x /bin/kill && /bin/kill $arglist || builtin kill $arglist } > > Just cause POSIX says something, doesn't mean that it is right. True. But in this case, it doesn't make it wrong, either. Another argument for making kill a builtin is if you hit your ulimit on max processes, builtin kill will work, but trying an external kill will fail. -- Eric Blake From MAILER-DAEMON Thu Sep 29 18:41:20 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL75b-0008Lh-0W for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:41:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL75Y-0008K0-D6 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:41:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL75V-0008IA-JW for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:41:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL75A-0007TK-2I for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:40:52 -0400 Received: from [209.204.181.78] (helo=w250.z064001178.sjc-ca.dsl.cnc.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1EL6rN-0007at-1L for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:26:37 -0400 Received: (qmail 40695 invoked by uid 1000); 29 Sep 2005 22:26:56 -0000 Date: Thu, 29 Sep 2005 15:26:34 -0700 From: Jos Backus To: bug-coreutils@gnu.org Message-ID: <20050929222656.GA23300@lizzy.catnook.local> Mail-Followup-To: bug-coreutils@gnu.org References: <87irwja5yd.fsf@rho.meyering.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87irwja5yd.fsf@rho.meyering.net> User-Agent: Mutt/1.5.11 Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jos@catnook.com List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 22:41:17 -0000 On Fri, Sep 30, 2005 at 12:02:02AM +0200, Jim Meyering wrote: > date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I) > option is deprecated; it still works, but new applications should avoid it. > date, du, ls, and pr's time formats now support new %:z, %::z, %:::z > specifiers for numeric time zone offsets like -07:00, -07:00:00, and -07. A belated thanks to Paul, Jim and Eric for this addition. -- Jos Backus jos at catnook.com From MAILER-DAEMON Thu Sep 29 18:54:21 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL7IA-0004h6-NM for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:54:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL7I6-0004fJ-Sv for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:54:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL7I3-0004dB-ON for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:54:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL7I3-0004d3-Av for bug-coreutils@gnu.org; Thu, 29 Sep 2005 18:54:11 -0400 Received: from [195.135.220.15] (helo=mx2.suse.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EL7EM-0001Gh-Dy; Thu, 29 Sep 2005 18:50:22 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id BBABE1CC2B; Fri, 30 Sep 2005 00:50:19 +0200 (CEST) From: Andreas Schwab To: ericblake@comcast.net (Eric Blake) References: <092920052239.575.433C6D1C0008A5630000023F22064246130A050E040D0C079D0A@comcast.net> X-Yow: Does that mean I'm not a well-adjusted person?? Date: Fri, 30 Sep 2005 00:50:18 +0200 In-Reply-To: <092920052239.575.433C6D1C0008A5630000023F22064246130A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Thu, 29 Sep 2005 22:39:24 +0000") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 22:54:17 -0000 ericblake@comcast.net (Eric Blake) writes: >> Remember, POSIX requires kill(1) to be a shell builtin, because it >> must support job syntax ("kill %1", for example), which cannot be >> done with normal POSIX child process semantics. >>=20 >> In that case, one can make the builtin kill a wrapper, that parses the >> command line, and if it see %1 it replaces it with the process job pid >> and passes that to the real kill, or the builtin kill if no system >> kill utiltiy exists. > > Write your own shell function that does just that. You can > use 'jobs -p' to find the process number. Or 'jobs -x' to make that a one-liner. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From MAILER-DAEMON Thu Sep 29 19:08:10 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL7VW-0003ej-7W for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:08:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL7VQ-0003aG-Ua for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:08:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL7VM-0003Wo-TW for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:07:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL7VM-0003V4-DV for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:07:56 -0400 Received: from [130.238.164.5] (helo=elvira.ekonomikum.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL7V1-0002bg-Vl for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:07:36 -0400 Received: by elvira.ekonomikum.uu.se (Postfix, from userid 204) id 3C44C579; Fri, 30 Sep 2005 01:07:35 +0200 (MSZ) Received: from elvira.ekonomikum.uu.se(127.0.0.1) by elvira.ekonomikum.uu.se via virus-scan id s26633; Fri, 30 Sep 05 01:07:28 +0200 Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by elvira.ekonomikum.uu.se (Postfix) with ESMTP id 3EA0356E; Fri, 30 Sep 2005 01:07:27 +0200 (MSZ) Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id CD70044004; Fri, 30 Sep 2005 01:07:27 +0200 (CEST) Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21632-02-14; Fri, 30 Sep 2005 01:07:26 +0200 (CEST) Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 6B1A344003; Fri, 30 Sep 2005 01:07:26 +0200 (CEST) Received: (nullmailer pid 2769 invoked by uid 30270); Thu, 29 Sep 2005 23:07:26 -0000 From: "Alfred M\. Szmidt" To: ericblake@comcast.net (Eric Blake) In-reply-to: <092920052239.575.433C6D1C0008A5630000023F22064246130A050E040D0C079D0A@comcast.net> (ericblake@comcast.net) References: <092920052239.575.433C6D1C0008A5630000023F22064246130A050E040D0C079D0A@comcast.net> Date: Fri, 30 Sep 2005 01:07:26 +0200 Message-Id: <1128035246.336804.2768.nullmailer@Update.UU.SE> Cc: bug-coreutils@gnu.org Subject: Re: pkill X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ams@gnu.org List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 23:08:03 -0000 Write your own shell function that does just that. Nice, but I'd rather have it default in bash. Might just patch that horrid beast... True. But in this case, it doesn't make it wrong, either. Another argument for making kill a builtin is if you hit your ulimit on max processes, builtin kill will work, but trying an external kill will fail. One can always call the builtin explicitly. I.e. kill and `builtin kill' could behave differently. From MAILER-DAEMON Thu Sep 29 19:40:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EL80U-0004HZ-JV for mharc-bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:40:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL80N-0004FF-UX for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:40:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL80L-0004Dv-3R for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:39:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL7yH-0003Gv-3V for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:37:49 -0400 Received: from [216.148.227.118] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EL7gD-0003NE-A7 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 19:19:09 -0400 Received: from 204.127.197.117 ([204.127.197.117]) by comcast.net (rwcrmhc13) with SMTP id <2005092923190801500rtbm2e>; Thu, 29 Sep 2005 23:19:08 +0000 Received: from [128.170.36.44] by 204.127.197.117; Thu, 29 Sep 2005 23:19:07 +0000 From: ericblake@comcast.net (Eric Blake) To: Jim Meyering Date: Thu, 29 Sep 2005 23:19:07 +0000 Message-Id: <092920052319.3537.433C766A000D832000000DD122007340760A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 23:40:04 -0000 > There have been many changes since the last release (unstable 5.3.0). > So many that I feel 5.90 should also be considered unstable, at least > initially. Minor nit during compilation on cygwin: make[3]: Entering directory `/home/eblake/coreutils-5.90/src' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I. -I../lib -I../lib -g2 -Wall -MT dd.o -MD -MP -MF ".deps/dd.Tpo" -c -o dd.o dd.c; \ then mv -f ".deps/dd.Tpo" ".deps/dd.Po"; else rm -f ".deps/dd.Tpo"; exit 1; fi dd.c: In function `main': dd.c:1661: warning: long unsigned int format, size_t arg (arg 5) As I still haven't been able to convince my employer to sign a copyright disclaimer, there are several patches that are essential for operation on cygwin (such as a replacement to freopen that accepts a NULL first argument) that are not in the official release, but which will appear in the cygwin distribution in the next few days once I make a cygwin distro of coreutils-5.90. Thanks again for all your hard work in maintaining such a diverse, yet essential, group of programs. -- Eric Blake From MAILER-DAEMON Fri Sep 30 00:05:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELC9S-0003HC-42 for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 00:05:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EL3Bq-0001Gq-Gd for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EL3BY-00010j-N0 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EL3BV-0000x8-Vt for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:31:10 -0400 Received: from [69.17.117.26] (helo=mail24.sea5.speakeasy.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EL35e-0007Yk-90 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 14:25:06 -0400 Received: (qmail 16627 invoked from network); 29 Sep 2005 18:25:00 -0000 Received: from dsl092-144-240.wdc2.dsl.speakeasy.net ([66.92.144.240]) (envelope-sender ) by mail24.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 29 Sep 2005 18:25:00 -0000 From: Nino Pereira To: bug-coreutils@gnu.org Content-Type: text/plain Organization: Ecopulse, Inc Date: Thu, 29 Sep 2005 14:24:59 -0400 Message-Id: <1128018299.1016.45.camel@lithium> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 30 Sep 2005 00:05:35 -0400 Subject: ls X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pereira@speakeasy.net List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 18:33:04 -0000 Hi, (first, thank you for the marvellous gnu/linux system. I love it). I've been trying to find where the command 'ls' gets its color information. I can find this only for some distributions (where it can be in .dir_colors), but not for the one I'm using (debian). Is it possible to add this information in the description of the option --color in the ls man pages? Thank you, Nino R. Pereira From MAILER-DAEMON Fri Sep 30 01:10:32 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELDAG-0003JE-JB for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:10:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELD62-0002hZ-3n for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:06:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELD5o-0002ap-LZ for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:05:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELD5j-0002XG-6p for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:05:51 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELCui-0007QM-St for bug-coreutils@gnu.org; Fri, 30 Sep 2005 00:54:29 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8U4sR401425 for ; Thu, 29 Sep 2005 21:54:27 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELCuh-0002eD-A2 for bug-coreutils@gnu.org; Thu, 29 Sep 2005 21:54:27 -0700 To: bug-coreutils@gnu.org From: Paul Eggert Date: Thu, 29 Sep 2005 21:54:27 -0700 Message-ID: <8764sjrw8s.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: "tail - f" fix for NEWS X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 05:10:31 -0000 In rereading the NEWS I noticed that I messed up the description of "tail - f". This usage doesn't conform to POSIX 1003.1-2001, so it's not a problematic usage if we're worried only about conforming to both standards. However, it's still problematic in a different sense (most people are surprised to hear that it ignores the "-" in POSIX 1003.2-1992), so I installed this patch to try to clarify the situation a bit. 2005-09-29 Paul Eggert * NEWS: Clarify "tail - f" example. --- NEWS 29 Sep 2005 17:12:16 -0000 1.316 +++ NEWS 30 Sep 2005 04:50:48 -0000 1.317 @@ -38,11 +38,14 @@ GNU coreutils NEWS POSIX 1003.2-1992 POSIX 1003.1-2001 sort +4 sort -k 5 sort ./+4 tail +4 tail -n +4 tail ./+4 - tail - main.c tail main.c tail -- - main.c + tail - f tail f [see (*) below] tail -c 4 tail -c 10 ./4 tail -c4 touch 12312359 f touch -t 12312359 f touch ./12312359 f uniq +4 uniq -s 4 uniq ./+4 + (*) "tail - f" does not conform to POSIX 1003.1-2001; to read + standard input and then "f", use the command "tail -- - f". + These changes are in response to decisions taken in the January 2005 Austin Group standardization meeting. For more details, please see "Utility Syntax Guidelines" in the Minutes of the January 2005 From MAILER-DAEMON Fri Sep 30 01:14:26 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELDE2-00050d-0n for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:14:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELDDy-0004zI-3u for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:14:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELDDr-0004vo-23 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:14:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELDDq-0004uZ-HU for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:14:14 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELD9x-0008DP-Ss for bug-coreutils@gnu.org; Fri, 30 Sep 2005 01:10:14 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8U5AB402130; Thu, 29 Sep 2005 22:10:11 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELD9v-00035D-3Z; Thu, 29 Sep 2005 22:10:11 -0700 To: ericblake@comcast.net (Eric Blake) References: <092920052319.3537.433C766A000D832000000DD122007340760A050E040D0C079D0A@comcast.net> From: Paul Eggert Date: Thu, 29 Sep 2005 22:10:11 -0700 In-Reply-To: <092920052319.3537.433C766A000D832000000DD122007340760A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Thu, 29 Sep 2005 23:19:07 +0000") Message-ID: <871x37rvik.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 05:14:23 -0000 ericblake@comcast.net (Eric Blake) writes: > dd.c:1661: warning: long unsigned int format, size_t arg (arg 5) Thanks; I installed this patch. Jim -- I'm not sure what version number you want at the top of ChangeLog so I left it out for now. 2005-09-29 Paul Eggert * src/dd.c (main): Don't assume size_t has the same width as unsigned long. Problem reported by Eric Blake. --- src/dd.c 16 Sep 2005 09:35:47 -0000 1.187 +++ src/dd.c 30 Sep 2005 05:07:11 -0000 1.188 @@ -1652,13 +1652,14 @@ main (int argc, char **argv) if (seek_records != 0 && !(conversions_mask & C_NOTRUNC)) { uintmax_t size = seek_records * output_blocksize; + unsigned long int obs = output_blocksize; if (OFF_T_MAX / output_blocksize < seek_records) error (EXIT_FAILURE, 0, _("offset too large: " "cannot truncate to a length of seek=%"PRIuMAX"" " (%lu-byte) blocks"), - seek_records, output_blocksize); + seek_records, obs); if (ftruncate (STDOUT_FILENO, size) != 0) { From MAILER-DAEMON Fri Sep 30 04:00:36 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELFoo-0006Pm-9d for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 04:00:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELFok-0006OW-Nb for bug-coreutils@gnu.org; Fri, 30 Sep 2005 04:00:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELFnj-00064x-Ag for bug-coreutils@gnu.org; Fri, 30 Sep 2005 03:59:27 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELFlJ-00051E-1m for bug-coreutils@gnu.org; Fri, 30 Sep 2005 03:56:58 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELF0u-0007dq-4e for bug-coreutils@gnu.org; Fri, 30 Sep 2005 03:09:00 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8U78x408152 for ; Fri, 30 Sep 2005 00:08:59 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELF0t-0003Hl-0s for bug-coreutils@gnu.org; Fri, 30 Sep 2005 00:08:59 -0700 To: bug-coreutils@gnu.org Message-Id: From: Paul Eggert Date: Fri, 30 Sep 2005 00:08:59 -0700 Subject: questions and maybe a patch about fdopendir in coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 08:00:31 -0000 A few things things about fdopendir. 1. Yesterday, fdopendir was added to glibc. The patch below attempts to address this, but I have a few qualms about this since I haven't tested it with glibc CVS, though -- I don't have that easily available. 2. I'm not sure what that AT_FDCWD test is doing in fdopendir's implementation. That behavior isn't documented in the Sun manual that I can see. (It's not in glibc either, but that's to be expected.) As far as I can see, coreutils never passes AT_FDCWD to fdopendir so removing this test shouldn't change coreutils itself. 3. The Sun documentation says fdopendir consumes its fd only if fdopendir is successful. 4. Is all this academic? coreutils never uses lib/openat.c's fdopendir that I can see. getcwd.c uses fdopendir only if AT_FDCWD is defined in the system headers, which means it doesn't use openat.c's fdopendir, right? Maybe fdopendir should simply be removed from openat.h and openat.c, to avoid possible collisions with glibc? But if not, here's a proposed patch: 2005-09-29 Paul Eggert * lib/openat.c (fdopendir): Do not define if HAVE_FDOPENDIR. Remove AT_FDCWD test. Do not consume the fd unless successful. * lib/openat.h (fdopendir): Do not define if HAVE_FDOPENDIR. * m4/openat.m4 (gl_FUNC_OPENAT): Check for fdopendir. Index: lib/openat.c =================================================================== RCS file: /fetish/cu/lib/openat.c,v retrieving revision 1.13 diff -p -u -r1.13 openat.c --- lib/openat.c.~1.13.~ 2005-09-21 23:05:39.000000000 -0700 +++ lib/openat.c 2005-09-29 23:56:30.000000000 -0700 @@ -89,6 +89,8 @@ rpl_openat (int fd, char const *file, in return new_fd; } +#if !HAVE_FDOPENDIR + /* Replacement for Solaris' function by the same name. Simulate it by doing save_cwd/fchdir/opendir(".")/restore_cwd. @@ -100,7 +102,7 @@ rpl_openat (int fd, char const *file, in W A R N I N G: Unlike the other fd-related functions here, this one effectively consumes its FD parameter. The caller should not - close or otherwise manipulate FD after calling this function. */ + close or otherwise manipulate FD if this function returns successfully. */ DIR * fdopendir (int fd) { @@ -108,9 +110,6 @@ fdopendir (int fd) int saved_errno; DIR *dir; - if (fd == AT_FDCWD) - return opendir ("."); - if (save_cwd (&saved_cwd) != 0) openat_save_fail (errno); @@ -118,7 +117,6 @@ fdopendir (int fd) { saved_errno = errno; free_cwd (&saved_cwd); - close (fd); errno = saved_errno; return NULL; } @@ -130,12 +128,15 @@ fdopendir (int fd) openat_restore_fail (errno); free_cwd (&saved_cwd); - close (fd); + if (dir) + close (fd); errno = saved_errno; return dir; } +#endif + /* Replacement for Solaris' function by the same name. Simulate it by doing save_cwd/fchdir/(stat|lstat)/restore_cwd. Index: lib/openat.h =================================================================== RCS file: /fetish/cu/lib/openat.h,v retrieving revision 1.11 diff -p -u -r1.11 openat.h --- lib/openat.h 19 Sep 2005 15:44:57 -0000 1.11 +++ lib/openat.h 30 Sep 2005 06:47:03 -0000 @@ -46,7 +46,9 @@ # define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y) # define openat __OPENAT_ID (openat) int openat (int fd, char const *file, int flags, /* mode_t mode */ ...); -# define fdopendir __OPENAT_ID (fdopendir) +# if ! HAVE_FDOPENDIR +# define fdopendir __OPENAT_ID (fdopendir) +# endif DIR *fdopendir (int fd); # define fstatat __OPENAT_ID (fstatat) int fstatat (int fd, char const *file, struct stat *st, int flag); Index: m4/openat.m4 =================================================================== RCS file: /fetish/cu/m4/openat.m4,v retrieving revision 1.5 diff -p -u -r1.5 openat.m4 --- m4/openat.m4 14 Jun 2005 07:47:52 -0000 1.5 +++ m4/openat.m4 30 Sep 2005 06:47:03 -0000 @@ -1,4 +1,4 @@ -#serial 4 +#serial 5 # See if we need to use our replacement for Solaris' openat function. dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. @@ -13,6 +13,7 @@ AC_DEFUN([gl_FUNC_OPENAT], AC_LIBSOURCES([openat.c, openat.h, openat-die.c]) AC_LIBOBJ([openat-die]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_FUNCS_ONCE([fdopendir]) AC_REPLACE_FUNCS(openat) case $ac_cv_func_openat in yes) ;; From MAILER-DAEMON Fri Sep 30 09:11:07 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELKfJ-0004vJ-Lk for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:11:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELKfD-0004qO-GA for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:10:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELKfA-0004oD-Fe for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:10:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELKf5-0004l5-CQ; Fri, 30 Sep 2005 09:10:51 -0400 Received: from [147.231.88.1] (helo=matsrv.math.cas.cz) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ELKej-0001Lm-E1; Fri, 30 Sep 2005 09:10:29 -0400 Received: from matsrv.math.cas.cz (matsrv.math.cas.cz [127.0.0.1]) by matsrv.math.cas.cz (8.12.11/8.12.11) with ESMTP id j8UDAQtc009022; Fri, 30 Sep 2005 15:10:26 +0200 Received: (from kasal@localhost) by matsrv.math.cas.cz (8.12.11/8.12.11/Submit) id j8UDAQDR009021; Fri, 30 Sep 2005 15:10:26 +0200 Date: Fri, 30 Sep 2005 15:10:26 +0200 From: Stepan Kasal To: bug-autoconf@gnu.org, bug-coreutils@gnu.org Message-ID: <20050930131026.GA7246@math.cas.cz> Mail-Followup-To: bug-autoconf@gnu.org, bug-coreutils@gnu.org References: <87br2cdpxz.fsf@rho.meyering.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87br2cdpxz.fsf@rho.meyering.net> User-Agent: Mutt/1.4.1i X-Virus-Scanned: ClamAV version 0.86.2, clamav-milter version 0.86 on localhost X-Virus-Status: Clean Cc: Subject: Re: Warning! autoconf can generate very long lines in Makefiles X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 13:11:02 -0000 Hello Jim, your report mentions three problems: 1) The value of LIBOBJS can get very long. I think the right fix here is to change this to multiline substitution: LIBOBJS = ${LIBOBJDIR}backupfile$U.o \ ${LIBOBJDIR}basename$U.o \ ... Autoconf is readu for multiline substitutions, thanks to Dan Manthey, but Automake is not. I'll start a discussion on the Automake list soon. 2) LTLIBOBJS might get very long. I think Automake should generate this: LTLIBOBJS = $(LIBOBJS:@OBJEXT@=.lo) Again, I hope to submit a patch to Automake-patches soon. 3) am__DEPENDENCIES_1 = @LIBOBJS@ I think that Automake should generate $(LIBOBJS) here. I have a patch, the testsuite is running. If it succeeds, I'll submit the patch later today. Finally, let me append a minor comment which is almost unrelated: coreutils-5.90/lib/Makefile.am contains line: libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD) I think this line should be deleted; Automake generates an equivalent one. Have a nice day, Stepan From MAILER-DAEMON Fri Sep 30 09:40:37 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELL7s-0004q0-Mk for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:40:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELL7l-0004oh-Sw for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:40:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELL7j-0004o8-Na for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:40:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELL7i-0004no-4f for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:40:26 -0400 Received: from [204.127.202.59] (helo=sccrmhc14.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELL4y-0003cC-RE for bug-coreutils@gnu.org; Fri, 30 Sep 2005 09:37:37 -0400 Received: from [192.168.0.100] (c-67-172-242-110.hsd1.ut.comcast.net[67.172.242.110]) by comcast.net (sccrmhc14) with ESMTP id <2005093013373301400ps0roe>; Fri, 30 Sep 2005 13:37:33 +0000 Message-ID: <433D3F9F.3040304@byu.net> Date: Fri, 30 Sep 2005 07:37:35 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bug-coreutils@gnu.org X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: man/Makefile patch X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 13:40:32 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was annoyed that a failed man page run left garbage behind, breaking the next run. 2005-09-30 Eric Blake (tiny change) * man/Makefile.am (.x.1): Remove temp directory first. Index: man/Makefile.am =================================================================== RCS file: /cvsroot/coreutils/coreutils/man/Makefile.am,v retrieving revision 1.38 diff -u -p -r1.38 Makefile.am - --- man/Makefile.am 5 Apr 2005 22:21:14 -0000 1.38 +++ man/Makefile.am 30 Sep 2005 13:34:40 -0000 @@ -127,6 +127,7 @@ mapped_name = `echo $*|sed 's/install/gi .x.1: @rm -f $@ @echo "Updating man page $@"; \ + rm -rf $t; \ mkdir $t; \ (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \ $(PERL) -- $(srcdir)/help2man \ - -- Life is short - so eat dessert first! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDPT+f84KuGfSFAYARAjB3AKChFNJFHPcCPc9lHk3NoDZPYBZUKQCeLvU1 scmMlE4+wk8B2mrQIZ2cITM= =+ynl -----END PGP SIGNATURE----- From MAILER-DAEMON Fri Sep 30 10:32:08 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELLvj-000777-H2 for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 10:32:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELLve-00074Z-01 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 10:32:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELLvY-00071V-CK for bug-coreutils@gnu.org; Fri, 30 Sep 2005 10:31:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELLvX-0006tG-OU for bug-coreutils@gnu.org; Fri, 30 Sep 2005 10:31:55 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELLdt-0007G4-IS for bug-coreutils@gnu.org; Fri, 30 Sep 2005 10:13:41 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 58BD214EC; Fri, 30 Sep 2005 16:13:39 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: (Paul Eggert's message of "Fri, 30 Sep 2005 00:08:59 -0700") References: Date: Fri, 30 Sep 2005 16:13:39 +0200 Message-ID: <871x368wz0.fsf@rho.meyering.net> Lines: 46 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: questions and maybe a patch about fdopendir in coreutils X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 14:32:03 -0000 Paul Eggert wrote: > A few things things about fdopendir. > > 1. Yesterday, fdopendir was added to glibc. The patch below attempts > to address this, but I have a few qualms about this since I haven't > tested it with glibc CVS, though -- I don't have that easily > available. > > 2. I'm not sure what that AT_FDCWD test is doing in fdopendir's > implementation. That behavior isn't documented in the Sun manual that It doesn't belong. Thanks for catching it. > I can see. (It's not in glibc either, but that's to be expected.) As > far as I can see, coreutils never passes AT_FDCWD to fdopendir so > removing this test shouldn't change coreutils itself. > > 3. The Sun documentation says fdopendir consumes its fd only if > fdopendir is successful. Another. Thanks again. > 4. Is all this academic? coreutils never uses lib/openat.c's > fdopendir that I can see. getcwd.c uses fdopendir only if AT_FDCWD is > defined in the system headers, which means it doesn't use openat.c's > fdopendir, right? It's not academic at all. I added that function because an upcoming, sometimes-thread-safe, version of remove.c requires it. > Maybe fdopendir should simply be removed from openat.h and openat.c, > to avoid possible collisions with glibc? > > But if not, here's a proposed patch: Thanks. Applied. > 2005-09-29 Paul Eggert > > * lib/openat.c (fdopendir): Do not define if HAVE_FDOPENDIR. > Remove AT_FDCWD test. > Do not consume the fd unless successful. > * lib/openat.h (fdopendir): Do not define if HAVE_FDOPENDIR. > * m4/openat.m4 (gl_FUNC_OPENAT): Check for fdopendir. From MAILER-DAEMON Fri Sep 30 12:34:59 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELNqd-00023p-5P for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:34:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELNpp-0001fT-M3 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:34:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELNpa-0001Wu-Bi for bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:33:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELNpZ-0001Uj-Cq for bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:33:53 -0400 Received: from [82.230.74.64] (helo=rho.meyering.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELNkJ-0001LI-00 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:28:27 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id A079B14EC; Fri, 30 Sep 2005 18:28:25 +0200 (CEST) From: Jim Meyering To: Paul Eggert In-Reply-To: <871x37rvik.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Thu, 29 Sep 2005 22:10:11 -0700") References: <092920052319.3537.433C766A000D832000000DD122007340760A050E040D0C079D0A@comcast.net> <871x37rvik.fsf@penguin.cs.ucla.edu> Date: Fri, 30 Sep 2005 18:28:25 +0200 Message-ID: <87r7b67c5y.fsf@rho.meyering.net> Lines: 100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, Eric Blake Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 16:34:56 -0000 Paul Eggert wrote: > ericblake@comcast.net (Eric Blake) writes: > >> dd.c:1661: warning: long unsigned int format, size_t arg (arg 5) > > Thanks; I installed this patch. > > Jim -- I'm not sure what version number you want at the top of > ChangeLog so I left it out for now. I've taken care of that. 5.91-cvs. > 2005-09-29 Paul Eggert > > * src/dd.c (main): Don't assume size_t has the same width > as unsigned long. Problem reported by Eric Blake. > > --- src/dd.c 16 Sep 2005 09:35:47 -0000 1.187 > +++ src/dd.c 30 Sep 2005 05:07:11 -0000 1.188 > @@ -1652,13 +1652,14 @@ main (int argc, char **argv) > if (seek_records != 0 && !(conversions_mask & C_NOTRUNC)) > { > uintmax_t size = seek_records * output_blocksize; > + unsigned long int obs = output_blocksize; > > if (OFF_T_MAX / output_blocksize < seek_records) > error (EXIT_FAILURE, 0, > _("offset too large: " > "cannot truncate to a length of seek=%"PRIuMAX"" > " (%lu-byte) blocks"), > - seek_records, output_blocksize); > + seek_records, obs); > > if (ftruncate (STDOUT_FILENO, size) != 0) > { I think it's about time we started using a format string for size_t values, rather than trying to shoe-horn them into some other format. How about something like this: Index: dd.c =================================================================== RCS file: /fetish/cu/src/dd.c,v retrieving revision 1.188 diff -u -p -r1.188 dd.c --- dd.c 30 Sep 2005 05:07:11 -0000 1.188 +++ dd.c 30 Sep 2005 07:39:33 -0000 @@ -1652,14 +1652,13 @@ main (int argc, char **argv) if (seek_records != 0 && !(conversions_mask & C_NOTRUNC)) { uintmax_t size = seek_records * output_blocksize; - unsigned long int obs = output_blocksize; if (OFF_T_MAX / output_blocksize < seek_records) error (EXIT_FAILURE, 0, _("offset too large: " "cannot truncate to a length of seek=%"PRIuMAX"" - " (%lu-byte) blocks"), - seek_records, obs); + " (%"PRI_z"-byte) blocks"), + seek_records, output_blocksize); if (ftruncate (STDOUT_FILENO, size) != 0) { Then we need to define PRI_z. Probably need an autoconf test, but this might just do, assuming the needed symbols are always defined. I deliberately omitted unsigned long long, on the presumption that that type has the same size as either unsigned long or uintmax_t, and because it's a little trickier. Does anyone know of a system where that's not true? Index: system.h =================================================================== RCS file: /fetish/cu/src/system.h,v retrieving revision 1.137 diff -u -p -r1.137 system.h --- system.h 28 Sep 2005 22:11:06 -0000 1.137 +++ system.h 30 Sep 2005 15:28:31 -0000 @@ -57,6 +57,17 @@ you must include before in #include "pathmax.h" #include "localedir.h" +/* Determine a printf conversion specifier that is appropriate for size_t. + Ideally, we'd just use the c99-specified `z' length modifier, defining + PRI_z to "zu", but that's not portable. */ +#if SIZE_MAX == UINT_MAX +# define PRI_z "u" +#elif SIZE_MAX == ULONG_MAX +# define PRI_z "lu" +#else +# define PRI_z PRIuMAX +#endif + #if TIME_WITH_SYS_TIME # include # include From MAILER-DAEMON Fri Sep 30 12:46:53 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELO29-00054k-6r for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 12:46:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELHti-0000j1-D9 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 06:13:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELHtZ-0000eE-04 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 06:13:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELHtX-0000UA-GV for bug-coreutils@gnu.org; Fri, 30 Sep 2005 06:13:35 -0400 Received: from [68.142.200.165] (helo=web31002.mail.mud.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1ELHpA-00043X-Ra for bug-coreutils@gnu.org; Fri, 30 Sep 2005 06:09:05 -0400 Received: (qmail 68111 invoked by uid 60001); 30 Sep 2005 10:02:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=rOQhoz65i/Lja2Qr+S9Gn4lCgSw+BDR2OqOVeojZht1rmgJ1Q1tZ5ZMFkhmZNHIu8krgv1aW75U2VQLPOW1Epp/yYVdxtIF1qU5Zb3Ihr/WRsj2OwYFB1hkjZhF263YU2gCtB81aI8APyEpqJ/8MUXO/4sJWnE/qj2vvv3fas40= ; Message-ID: <20050930100223.68109.qmail@web31002.mail.mud.yahoo.com> Received: from [194.247.199.6] by web31002.mail.mud.yahoo.com via HTTP; Fri, 30 Sep 2005 03:02:22 PDT Date: Fri, 30 Sep 2005 03:02:22 -0700 (PDT) From: Djuradj Uzelac To: djm@gnu.org, bug-coreutils@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 30 Sep 2005 12:46:52 -0400 Cc: Subject: [chown -R user_id:grpup_id] PROBLEM %CPU=99.7 %MEM=90.3 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 10:13:49 -0000 My apologize, I have a problem with chown command evrythink was working propertly and I do not known what was hapening. At once ........ I use SuSe distribution, version : ====================== cat /etc/SuSE-release ---------------------- SuSE Linux 9.0 (i586) VERSION = 9.0 ---------------------- uname -r ---------------------- 2.4.21-286-default ====================== Package on Linux server: ------------------------ coreutils-5.0-90 yast2-core-2.8.37-4 *** I try to describe a problem I have to add a new user on linux server I start yast2 control panel and after enter a first name , last name, user name and passwd and after enter Create and Finish button yast2 stop on progress bar on 37% ...... I open a new session command line and entered a top command and see that chown command use a much more cpu and memory resource =================================================================== top ------------------------------------------------------------------- PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6449 root 25 0 42284 41m 548 R 95.6 88.2 02:06.60 chown =================================================================== in that time command ps =================================================================== ps ax | grep chown ------------------------------------------------------------------- 6814 pts/3 R 0:04 chown -R 735:100 /home/new_username/ 6817 pts/0 S 0:00 grep chown =================================================================== after a few minutes have a log from kernel ================================================================================= cat /var/log/messages/ | grep alloc --------------------------------------------------------------------------------- Sep 28 14:49:49 ens kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0) Sep 28 15:53:00 ens kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0) Sep 28 15:53:00 ens kernel: __alloc_pages: 0-order allocation failed (gfp=0x1d2/0) Sep 28 15:57:27 ens kernel: __alloc_pages: 0-order allocation failed (gfp=0x1d2/0) Sep 28 15:57:27 ens kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0) ================================================================================== I enter a command ------------------------------------ chown -R 735:100 /home/new_username/ ------------------------------------ from command line without yast2 and the problem is exist !!! and very interesting is it what comand ----------------------------------------------- chown -R new_username.group /home/new_username/ <<<< WORKING !!!!!!!!!!!!!!! ----------------------------------------------- ==================================== RESUME ------------------------------------ chown -R 735:100 DO NOT WORK chown -R new_username.group WORK :) ==================================== Please contact me if you have a any idea to solve a problem and if you have a much more any information beforehand thanks best regards Dj. __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com From MAILER-DAEMON Fri Sep 30 13:36:52 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELOoV-0003DD-Om for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 13:36:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELOoS-0003B0-Ky for bug-coreutils@gnu.org; Fri, 30 Sep 2005 13:36:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELOoP-00039c-Tc for bug-coreutils@gnu.org; Fri, 30 Sep 2005 13:36:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELOoP-00038f-DL for bug-coreutils@gnu.org; Fri, 30 Sep 2005 13:36:45 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELOne-0006ZE-6d for bug-coreutils@gnu.org; Fri, 30 Sep 2005 13:35:58 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8UHZL412920; Fri, 30 Sep 2005 10:35:21 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELOn3-0003VK-2Y; Fri, 30 Sep 2005 10:35:21 -0700 To: Jim Meyering References: <092920052319.3537.433C766A000D832000000DD122007340760A050E040D0C079D0A@comcast.net> <871x37rvik.fsf@penguin.cs.ucla.edu> <87r7b67c5y.fsf@rho.meyering.net> From: Paul Eggert Date: Fri, 30 Sep 2005 10:35:21 -0700 In-Reply-To: <87r7b67c5y.fsf@rho.meyering.net> (Jim Meyering's message of "Fri, 30 Sep 2005 18:28:25 +0200") Message-ID: <87oe6ae9wm.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org, Eric Blake Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 17:36:50 -0000 Jim Meyering writes: > +/* Determine a printf conversion specifier that is appropriate for size_t. > + Ideally, we'd just use the c99-specified `z' length modifier, defining > + PRI_z to "zu", but that's not portable. */ > +#if SIZE_MAX == UINT_MAX > +# define PRI_z "u" > +#elif SIZE_MAX == ULONG_MAX > +# define PRI_z "lu" > +#else > +# define PRI_z PRIuMAX > +#endif I thought about doing that a while ago but gave it up because it appears that this sort of approach will run afoul of gettext. That is, xgettext groks standard C macros like PRIuMAX as a special case, but it doesn't understand arbitrary C macros that we write. Hence the formats won't be entered into the .po files properly. Also, there might be problems on hosts where UINT_MAX == ULONG_MAX and size_t is unsigned long int rather than unsigned int. This latter problem is fixable, but the other one isn't easily fixable. From MAILER-DAEMON Fri Sep 30 14:06:45 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELPHR-00037k-Ev for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:06:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELPHO-00036c-ES for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:06:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELPHN-00036G-8V for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:06:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELPGk-0002dN-DQ for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:06:02 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1ELPGj-0000th-QB for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:06:02 -0400 Received: (qmail invoked by alias); 30 Sep 2005 18:05:57 -0000 Received: from dialin-145-254-107-087.pools.arcor-ip.net (EHLO thommy.koffer.de) [145.254.107.87] by mail.gmx.net (mp014) with SMTP; 30 Sep 2005 20:05:57 +0200 X-Authenticated: #17748452 Received: from gmx.de (thommy.koffer.de [192.168.69.1]) by thommy.koffer.de (8.8.8/8.8.8) with ESMTP id UAA05393; Fri, 30 Sep 2005 20:00:03 +0200 Sender: root@thommy.koffer.de Message-ID: <433D7D23.FED86F09@gmx.de> Date: Fri, 30 Sep 2005 20:00:03 +0200 From: ThMO X-Mailer: Mozilla 4.08 [en] (X11; U; Linux 2.0.35 i686) MIME-Version: 1.0 To: Paul Eggert References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <871x3767af.fsf@penguin.cs.ucla.edu> Content-Type: multipart/mixed; boundary="------------261749E08E735B9FE4175330" X-Y-GMX-Trusted: 0 Cc: bug-coreutils@gnu.org Subject: Re6: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 18:06:42 -0000 This is a multi-part message in MIME format. --------------261749E08E735B9FE4175330 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello Paul and others listening, > >> Patches would we welcome here. > > > > Sorry, I should have been clearer. > > By "patch" I meant the output of "diff -pu" for all the files you > changed, along with ChangeLog entries appropriate for each file. We > should be able to take the existing source code, apply your patch by > using "patch -p0", and then do a "make check" and everything should > work just fine. You can see an example patch here: > . > > Typically the hardest part of writing a patch is the documentation. > Then the test cases. The source code is the easiest. I've attached a small ``diff -pu'' file patching 3 files: · src/factor.c · test/factor/basic · Changelog against coreutils v5.2.1 enhancing factor in order to factorize negative values too. Locally it works as expected without any compile-time warning using gcc's -Wall option along with heavy optimizing. The things I've added are commented, so you should be able to immediately see, what's going on. One word, before you're going to blame me - it's coded with my longstanding coding style, but if you're willing to integrate it, it should be no problem to run it through `indent' in order to be compatible with the GNU coding style, which I dislike. I've commented out one test inside the perl-script, as I don't know how to do programming in perl, but I'm sure, that you're able to make even this test case work. Also I've added two lines to the Changelog file reflecting the changes. As I see it, you'll be not able to directly apply this patch againts the current CVS version, since many things have changed. THX for listening. CU Tom. (Thomas M.Ott) Germany --------------261749E08E735B9FE4175330 Content-Type: text/plain; charset=us-ascii; name="extent.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="extent.diff" --- coreutils-5.2.1/src/factor.c.orig 2004-01-21 23:27:02.000000000 +0100 +++ coreutils-5.2.1/src/factor.c 2005-09-30 19:25:37.000000000 +0200 @@ -91,10 +91,99 @@ exit (status); } +/* using a union simplifies cast orgies in order to omit warnings (ThMO) */ + +union factor { + intmax_t sfac; + uintmax_t ufac; + }; + +#if HAVE_LONG_LONG + #define ONE 1LL +#else + #define ONE 1L +#endif + +/* sfactor(): factorize signed long (long) ints -- (ThMO) */ + +static int +sfactor( const intmax_t sn0, const size_t max_n_factors, union factor *factors) +{ + intmax_t sn; + uintmax_t n, d, q; + int n_factors; + const unsigned int *w; + + n_factors= 0; + switch ( sn= sn0) + { + case 0: case 1: case -1: + return( n_factors); + + case ONE << ( sizeof( sn)* CHAR_BIT- 1): + /* handle special case of smallest long (long) int */ + assert( 2 < max_n_factors); + factors[ n_factors++].sfac= -1, + factors[ n_factors++].sfac= 2; + sn= ONE << ( sizeof( sn)* CHAR_BIT- 2); + break; + + default: + if ( sn < 0) + { + assert( 1 < max_n_factors); + factors[ n_factors++].sfac= -1; + sn= -sn; + } + break; + } + + /* from now on the value is guaranteed to be positive, so force further + * calculations with unsigned quantities, since the evaluation of the + * remainder from a division will always have the correct sign, unlike + * the signed modulus operation - furthermore unsigned division is mostly + * somewhat faster than signed division -- (ThMO) + */ + for ( n= (uintmax_t) sn; ( n & 1) == 0; n >>= 1) + { + /* factorize by 2 the easy way... */ + assert( n_factors < max_n_factors); + factors[ n_factors++].ufac= 2; + } + + if ( n >= ( d= 3)) + { + /* this is basically the same algorithm as below - only we'll use + * the modulo operator (%), as the remainder will be delivered for + * free during division + */ + w= &wheel_tab[ 1]; + do + { + while ( q= n/ d, n % d == 0) + { + assert( n_factors < max_n_factors); + factors[ n_factors++].ufac= d; + n= q; + } + d += *w++; + if ( w == WHEEL_END) + w -= WHEEL_END- WHEEL_START; + } + while ( d <= q); + if ( n > 1) + { + assert( n_factors < max_n_factors); + factors[ n_factors++].ufac= n; + } + } + return( n_factors); +} + /* FIXME: comment */ static int -factor (uintmax_t n0, int max_n_factors, uintmax_t *factors) +factor (uintmax_t n0, int max_n_factors, union factor *factors) { register uintmax_t n = n0, d, q; int n_factors = 0; @@ -118,7 +207,7 @@ while (n == q * d) { assert (n_factors < max_n_factors); - factors[n_factors++] = d; + factors[n_factors++].ufac = d; n = q; q = n / d; } @@ -128,10 +217,10 @@ } while (d <= q); - if (n != 1 || n0 == 1) + if (n != 1) /* || n0 == 1 <-- can't happen -- (ThMO) */ { assert (n_factors < max_n_factors); - factors[n_factors++] = n; + factors[n_factors++].ufac = n; } return n_factors; @@ -139,16 +228,41 @@ /* FIXME: comment */ +#define ary_size( t) ( sizeof( (t))/ sizeof( (t)[ 0]) ) + static int print_factors (const char *s) { - uintmax_t factors[MAX_N_FACTORS]; + union factor factors[ MAX_N_FACTORS+ 1]; + intmax_t sn; uintmax_t n; int n_factors; int i; - char buf[INT_BUFSIZE_BOUND (uintmax_t)]; + char buf[ 1+ INT_BUFSIZE_BOUND (uintmax_t)]; strtol_error err; + if ( ( err= xstrtoimax( s, NULL, 10, &sn, "")) == LONGINT_OK) + { + /* factorize signed long (long) ints */ + n_factors= sfactor( sn, ary_size( factors), factors); + printf( "%s:", imaxtostr( sn, buf)); + for ( i= 0; i < n_factors; i++) + printf( " %s", imaxtostr( factors[ i].sfac, buf)); + printf( "\n"); + return( 0); + } + else if ( err != LONGINT_OVERFLOW) + { + error( 0, 0, _( "%s is not a valid integer"), s); + return( 1); + } + else if ( sn < 0) /* --> underflow */ + { + error( 0, 0, _( "%s is too small"), s); + return( 1); + } + + /* overflowing a signed long (long) int -> try it unsigned then */ if ((err = xstrtoumax (s, NULL, 10, &n, "")) != LONGINT_OK) { if (err == LONGINT_OVERFLOW) @@ -160,7 +274,7 @@ n_factors = factor (n, MAX_N_FACTORS, factors); printf ("%s:", umaxtostr (n, buf)); for (i = 0; i < n_factors; i++) - printf (" %s", umaxtostr (factors[i], buf)); + printf (" %s", umaxtostr (factors[i].ufac, buf)); putchar ('\n'); return 0; } --- coreutils-5.2.1/tests/factor/basic.orig 2003-04-08 12:36:44.000000000 +0200 +++ coreutils-5.2.1/tests/factor/basic 2005-09-30 19:27:26.000000000 +0200 @@ -54,10 +54,42 @@ $PERL -e 1 > /dev/null 2>&1 || { ['w', '4294966464', {OUT => '2 2 2 2 2 2 3 3 3 2485513'}], ['x', '4294966896', {OUT => '2 2 2 2 3 3 3 11 607 1489'}], ['y', '4294966998', {OUT => '2 3 7 3917 26107'}], - ['z', '-1', - {ERR => "$prog: `-1' is not a valid positive integer\n" - . "Try `$prog --help' for more information.\n"}, - {EXIT => 1}], +# ['z', '-1', +# {ERR => "$prog: `-1' is not a valid positive integer\n" +# . "Try `$prog --help' for more information.\n"}, +# {EXIT => 1}], + + ['M1', '-9', {OUT => '-1 3 3'}], + ['M1a', '-7', {OUT => '-1 7'}], + ['M2', '-4294967291', {OUT => '-1 4294967291'}], + ['M3', '-4294967292', {OUT => '-1 2 2 3 3 7 11 31 151 331'}], + ['M4', '-4294967293', {OUT => '-1 9241 464773'}], + + ['Ma', '-4294966201', {OUT => '-1 12197 352133'}], + ['Mb', '-4294966339', {OUT => '-1 13187 325697'}], + ['Mc', '-4294966631', {OUT => '-1 13729 312839'}], + ['Md', '-4294966457', {OUT => '-1 14891 288427'}], + ['Me', '-4294966759', {OUT => '-1 21649 198391'}], + ['Mf', '-4294966573', {OUT => '-1 23071 186163'}], + ['Mg', '-4294967101', {OUT => '-1 23603 181967'}], + ['Mh', '-4294966519', {OUT => '-1 34583 124193'}], + ['Mi', '-4294966561', {OUT => '-1 36067 119083'}], + ['Mj', '-4294966901', {OUT => '-1 37747 113783'}], + ['Mk', '-4294966691', {OUT => '-1 39241 109451'}], + ['Ml', '-4294966969', {OUT => '-1 44201 97169'}], + ['Mm', '-4294967099', {OUT => '-1 44483 96553'}], + ['Mn', '-4294966271', {OUT => '-1 44617 96263'}], + ['Mo', '-4294966789', {OUT => '-1 50411 85199'}], + ['Mp', '-4294966189', {OUT => '-1 53197 80737'}], + ['Mq', '-4294967213', {OUT => '-1 57139 75167'}], + ['Ms', '-4294967071', {OUT => '-1 65521 65551'}], + ['Mt', '-4294966194', {OUT => '-1 2 3 3 3 3 3 3 3 53 97 191'}], + ['Mu', '-4294966272', {OUT => '-1 2 2 2 2 2 2 2 2 2 2 3 23 89 683'}], + ['Mv', '-4294966400', {OUT => '-1 2 2 2 2 2 2 2 5 5 1342177'}], + ['Mw', '-4294966464', {OUT => '-1 2 2 2 2 2 2 3 3 3 2485513'}], + ['Mx', '-4294966896', {OUT => '-1 2 2 2 2 3 3 3 11 607 1489'}], + ['My', '-4294966998', {OUT => '-1 2 3 7 3917 26107'}], + ['Mz', '-2147483648', {OUT => '-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2'}], ); # Prepend the command line argument and append a newline to end --- coreutils-5.2.1/ChangeLog.orig 2004-03-12 20:03:44.000000000 +0100 +++ coreutils-5.2.1/ChangeLog 2005-09-30 19:30:24.000000000 +0200 @@ -1,3 +1,8 @@ +2005-09-30 Thomas M. Ott + + * src/factor.c: added factorizing of negative values + * test/factor/basic: add some test clauses + 2004-03-12 Jim Meyering * Version 5.2.1. --------------261749E08E735B9FE4175330-- From MAILER-DAEMON Fri Sep 30 14:40:40 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELPoG-0005Jb-6I for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:40:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELPkL-0004O1-F4 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:36:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELPkB-0004Ir-R2 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:36:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELPkA-00049s-FU for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:36:26 -0400 Received: from [204.127.198.54] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELPWN-0002bh-FM for bug-coreutils@gnu.org; Fri, 30 Sep 2005 14:22:11 -0400 Received: from 204.127.197.114 ([204.127.197.114]) by comcast.net (rwcrmhc14) with SMTP id <2005093018221001400b0lk7e>; Fri, 30 Sep 2005 18:22:10 +0000 Received: from [128.170.36.44] by 204.127.197.114; Fri, 30 Sep 2005 18:22:09 +0000 From: ericblake@comcast.net (Eric Blake) To: Paul Eggert , Jim Meyering Date: Fri, 30 Sep 2005 18:22:09 +0000 Message-Id: <093020051822.7721.433D8251000559CC00001E2922007503300A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: Re: coreutils-5.90 released X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 18:40:39 -0000 > > +/* Determine a printf conversion specifier that is appropriate for size_t. > > + Ideally, we'd just use the c99-specified `z' length modifier, defining > > + PRI_z to "zu", but that's not portable. */ > I thought about doing that a while ago but gave it up because it > appears that this sort of approach will run afoul of gettext. That > is, xgettext groks standard C macros like PRIuMAX as a special case, > but it doesn't understand arbitrary C macros that we write. Hence the > formats won't be entered into the .po files properly. Maybe it's time that we provide a gnulib module for printf that provides all modifiers required by C99 (and POSIX 2001), and use the gnulib version on losing systems. Then we could always assume %z, %j, %L, and %t work, without falling afoul of xgettext and without worrying whether size_t is unsigned int, unsigned long int, or unsigned long long int. -- Eric Blake From MAILER-DAEMON Fri Sep 30 16:04:47 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELR7e-0005lG-Pa for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 16:04:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELR74-0005cW-M1 for bug-coreutils@gnu.org; Fri, 30 Sep 2005 16:04:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELR6w-0005aG-Tx for bug-coreutils@gnu.org; Fri, 30 Sep 2005 16:04:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELR6w-0005Rt-JU for bug-coreutils@gnu.org; Fri, 30 Sep 2005 16:04:02 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELQop-00077M-Py for bug-coreutils@gnu.org; Fri, 30 Sep 2005 15:45:20 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8UJio425065; Fri, 30 Sep 2005 12:44:50 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELQoM-0003YB-HS; Fri, 30 Sep 2005 12:44:50 -0700 To: Djuradj Uzelac References: <20050930100223.68109.qmail@web31002.mail.mud.yahoo.com> From: Paul Eggert Date: Fri, 30 Sep 2005 12:44:50 -0700 In-Reply-To: <20050930100223.68109.qmail@web31002.mail.mud.yahoo.com> (Djuradj Uzelac's message of "Fri, 30 Sep 2005 03:02:22 -0700 (PDT)") Message-ID: <87fyrme3wt.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: [chown -R user_id:grpup_id] PROBLEM %CPU=99.7 %MEM=90.3 X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 20:04:23 -0000 Djuradj Uzelac writes: > coreutils-5.0-90 > chown -R 735:100 DO NOT WORK > chown -R new_username.group WORK :) Thanks for reporting this. That's odd. I can't reproduce this problem in my environment (Debian GNU/Linux 3.1 with coreutils 5.90 installed). Perhaps you can try coreutils test version 5.90 and see whether the problem still exists with its chown. There have been a lot of fixes to chown since 5.0 came out. ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.90.tar.gz From MAILER-DAEMON Fri Sep 30 18:00:13 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELSuA-0007kt-5F for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 17:58:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELStr-0007Yg-NL for bug-coreutils@gnu.org; Fri, 30 Sep 2005 17:58:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELSti-0007U7-Dz for bug-coreutils@gnu.org; Fri, 30 Sep 2005 17:58:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELSth-0007QQ-Ap for bug-coreutils@gnu.org; Fri, 30 Sep 2005 17:58:29 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELSsG-0005kx-3w for bug-coreutils@gnu.org; Fri, 30 Sep 2005 17:57:00 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8ULup409228; Fri, 30 Sep 2005 14:56:51 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELSs7-0005hy-1d; Fri, 30 Sep 2005 14:56:51 -0700 To: ThMO References: <4337FD31.35AE088B@gmx.de> <20050927030412.GA22548@dementia.proulx.com> <433AF0EF.3499CE39@gmx.de> <87wtl0u9cx.fsf@penguin.cs.ucla.edu> <433C1085.EE7C84F5@gmx.de> <871x3767af.fsf@penguin.cs.ucla.edu> <433D7D23.FED86F09@gmx.de> From: Paul Eggert Date: Fri, 30 Sep 2005 14:56:51 -0700 In-Reply-To: <433D7D23.FED86F09@gmx.de> (thmo-13@gmx.de's message of "Fri, 30 Sep 2005 20:00:03 +0200") Message-ID: <877jcydxss.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-coreutils@gnu.org Subject: Re: Re6: coreutils v5.2.1 - stat.c X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 21:58:44 -0000 ThMO writes: > + ['Ma', '-4294966201', {OUT => '-1 12197 352133'}], Now that I see these test cases I also see a reason why this is not a good idea. Currently, 'factor' outputs the unique factorization of the input number into primes. But there is no unique factorization for negative numbers. For example, OUT could have been '-12197 352133' or '12197 -352133'. I am becoming inclined to leave sleeping dogs lie here. Except perhaps 'factor' should also report an error if asked to factor zero. From MAILER-DAEMON Fri Sep 30 18:35:38 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELTTc-0000WQ-NK for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:35:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELTTX-0000U6-BQ for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:35:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELTTR-0000R5-TU for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:35:27 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELTTR-0000Qq-PY for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:35:25 -0400 Received: from [216.148.227.85] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELTT9-00085S-Lu for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:35:07 -0400 Received: from 204.127.197.112 ([204.127.197.112]) by comcast.net (rwcrmhc12) with SMTP id <2005093022350501400kmckte>; Fri, 30 Sep 2005 22:35:05 +0000 Received: from [128.170.36.44] by 204.127.197.112; Fri, 30 Sep 2005 22:35:05 +0000 From: ericblake@comcast.net (Eric Blake) To: Paul Eggert , ThMO Date: Fri, 30 Sep 2005 22:35:05 +0000 Message-Id: <093020052235.20932.433DBD990000907E000051C422007507440A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: bug-coreutils@gnu.org Subject: factor [Was: coreutils v5.2.1 - stat.c] X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 22:35:34 -0000 > > + ['Ma', '-4294966201', {OUT => '-1 12197 352133'}], > > Now that I see these test cases I also see a reason why this is not a > good idea. Currently, 'factor' outputs the unique factorization of > the input number into primes. But there is no unique factorization > for negative numbers. For example, OUT could have been '-12197 > 352133' or '12197 -352133'. If we decide to permit negative numbers, it seems like '-1' as the first factor would be the most useful, even though -1 is not a prime; then all the remaining factors ARE positive primes. Then, for consistency, -1 would print just -1, 0 would be an error, and 1 would print nothing. But I can also see keeping the status quo of only accepting positive integers, particularly since factor(1) is not standardized. > > I am becoming inclined to leave sleeping dogs lie here. Except > perhaps 'factor' should also report an error if asked to factor zero. Agreed, especially since zero is not a positive integer. However, it would also be nice if factor continued on with its remaining arguments, rather than exiting immediately on error: Currently: $ factor -- `seq -- -2 2` stderr> factor: `-2' is not a valid positive integer stderr> Try `./src/factor --help' for more information. $ echo $? 1 Proposed (if we keep negatives illegal): $ factor -- `seq -- -2 2` stderr> factor: `-2' is not a valid positive integer stderr> factor: `-1' is not a valid positive integer stderr> factor: `0' is not a valid positive integer stdout> 1: stdout> 2: 2 $ echo $? 1 Proposed (if we decide to allow negatives): $ factor -- `seq -- -2 2` stdout> -2: -1 2 stdout> -1: -1 stderr> factor: `0' has no factors stdout> 1: stdout> 2: 2 $ echo $? 1 Also something to think about - if factor is changed to accept negative numbers, then perhaps it should accept arguments that look like options: Current: $ factor -2 stderr> factor: invalid option -- 2 stderr> Try `factor --help' for more information. Proposed (if we keep negatives illegal): $ factor -2 stderr> factor: `-2' is not a valid positive integer stderr> Try `factor --help' for more information. Proposed (if we decide to allow negatives): $ factor -2 stdout> -2: -1 2 -- Eric Blake From MAILER-DAEMON Fri Sep 30 18:46:33 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELTeC-0004Ar-SA for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:46:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELTeA-0004A0-NT for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:46:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELTe8-00049K-PN for bug-coreutils@gnu.org; Fri, 30 Sep 2005 18:46:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELTe2-00042y-3p; Fri, 30 Sep 2005 18:46:22 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELTde-0000if-B6; Fri, 30 Sep 2005 18:45:58 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p1+Sun/8.11.7/UCLACS-5.2) with ESMTP id j8UMjv412678; Fri, 30 Sep 2005 15:45:57 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1ELTdd-0005wr-0O; Fri, 30 Sep 2005 15:45:57 -0700 To: bug-coreutils@gnu.org, bug-gnulib@gnu.org References: <093020051822.7721.433D8251000559CC00001E2922007503300A050E040D0C079D0A@comcast.net> From: Paul Eggert Date: Fri, 30 Sep 2005 15:45:56 -0700 In-Reply-To: <093020051822.7721.433D8251000559CC00001E2922007503300A050E040D0C079D0A@comcast.net> (Eric Blake's message of "Fri, 30 Sep 2005 18:22:09 +0000") Message-ID: <87wtkycgyj.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: printf (_("...%zu..."), X) where X is of type size_t X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 22:46:31 -0000 ericblake@comcast.net (Eric Blake) writes: >> > +/* Determine a printf conversion specifier that is appropriate for size_t. >> > + Ideally, we'd just use the c99-specified `z' length modifier, defining >> > + PRI_z to "zu", but that's not portable. */ >> ... >> I thought about doing that a while ago but gave it up because it >> appears that this sort of approach will run afoul of gettext. > ... > Maybe it's time that we provide a gnulib module for printf Personally I'd rather not head down that path. printf is the biggest cesspool in the C library, and lots of things that C likes to sweep under the rug finds its way into printf somehow: floating-point accuracy, cancellation points, multibyte encoding errors, signal handling, storage allocation, wrong-sized types for the job, etc., etc. I suppose we could drag glibc's printf into gnulib, but I wouldn't envy the task of doing that, or maintaining the result. If 'size' is of type size_t, then where I was suggesting this: unsigned long int s = size; printf (_("The size is %lu.\n"), size); the gettext manual suggests something like this instead: char buf[INT_BUFSIZE_BOUND (size_t)]; sprintf (buf, "%" PRIuSIZE, size); printf (_("The size is %s.\n"), buf1); where we define PRIuSIZE in system.h. But this is even more awkward. Perhaps GNU extensions PRIoSIZE, PRIuSIZE, PRIxSIZE, PRIXSIZE could be added to GNU gettext. That would mean we could write this instead: printf (_("The size is %"PRIuSIZE".\n"), size); which would be nicer than either of the above. It is curious that lacks the PRI* macros for size_t. I wonder why they left them out? From MAILER-DAEMON Fri Sep 30 19:06:39 2005 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ELTxc-0000DT-DI for mharc-bug-coreutils@gnu.org; Fri, 30 Sep 2005 19:06:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELTxZ-0000As-3N for bug-coreutils@gnu.org; Fri, 30 Sep 2005 19:06:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELTxV-00009k-3O for bug-coreutils@gnu.org; Fri, 30 Sep 2005 19:06:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELTxU-00009Y-Rq; Fri, 30 Sep 2005 19:06:28 -0400 Received: from [216.148.227.85] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELTwx-0001bG-4s; Fri, 30 Sep 2005 19:05:55 -0400 Received: from 204.127.197.189 ([204.127.197.189]) by comcast.net (rwcrmhc12) with SMTP id <2005093023055301400kn8jve>; Fri, 30 Sep 2005 23:05:54 +0000 Received: from [128.170.36.44] by 204.127.197.189; Fri, 30 Sep 2005 23:05:52 +0000 From: ericblake@comcast.net (Eric Blake) To: Paul Eggert , bug-coreutils@gnu.org, bug-gnulib@gnu.org Date: Fri, 30 Sep 2005 23:05:52 +0000 Message-Id: <093020052305.17842.433DC4D0000B4D5D000045B222092246270A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Dec 17 2004) X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 Cc: Subject: Re: printf (_("...%zu..."), X) where X is of type size_t X-BeenThere: bug-coreutils@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "GNU Core Utilities: bug reports and discussion" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 23:06:35 -0000 > >> > +/* Determine a printf conversion specifier that is appropriate for size_t. > >> > + Ideally, we'd just use the c99-specified `z' length modifier, defining > >> > + PRI_z to "zu", but that's not portable. */ > >> ... > >> I thought about doing that a while ago but gave it up because it > >> appears that this sort of approach will run afoul of gettext. > > ... > > Maybe it's time that we provide a gnulib module for printf > > Personally I'd rather not head down that path. printf is the biggest > cesspool in the C library, and lots of things that C likes to sweep > under the rug finds its way into printf somehow: floating-point > accuracy, cancellation points, multibyte encoding errors, signal > handling, storage allocation, wrong-sized types for the job, etc., > etc. I suppose we could drag glibc's printf into gnulib, but I > wouldn't envy the task of doing that, or maintaining the result. When I wrote my suggestion, I was thinking more along the lines of a thin wrapper, whose sole job in life is to translate the format string into something that the system's vprintf can already handle, without ever unwrapping the va_args itself. For that matter, since the translation does not need to know what the va_args are, maybe my suggestion is better written like this: printf (printf_format (_("The size is %zu.")), size); where we only provide printf_format, and its job is to turn the "%z" into "%l" or "%ll" in the translation, as appropriate. > Perhaps GNU extensions PRIoSIZE, PRIuSIZE, PRIxSIZE, PRIXSIZE could be > added to GNU gettext. That would mean we could write this instead: > > printf (_("The size is %"PRIuSIZE".\n"), size); > > which would be nicer than either of the above. But your idea of formalizing PRI?SIZE as part of is by far the nicest approach. > > It is curious that lacks the PRI* macros for size_t. > I wonder why they left them out? They also left out PRI* macros for ptrdiff_t (%t), since PRIdPTR applies to intptr_t instead. Plus, it might be nice to have PRIdSIZE and PRIiSIZE for ssize_t (although that assumes that ssize_t and size_t map to the same integer type - %zd is only specified to operate on the corresponding signed type matching size_t, which is not necessarily ssize_t). -- Eric Blake