From debbugs-submit-bounces@debbugs.gnu.org Thu May 05 02:01:04 2011 Received: (at submit) by debbugs.gnu.org; 5 May 2011 06:01:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QHrcV-0005WJ-Ex for submit@debbugs.gnu.org; Thu, 05 May 2011 02:01:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QHrNl-00059W-G4 for submit@debbugs.gnu.org; Thu, 05 May 2011 01:45:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHrNf-0004DZ-CP for submit@debbugs.gnu.org; Thu, 05 May 2011 01:45:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:51580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHrNf-0004DV-B7 for submit@debbugs.gnu.org; Thu, 05 May 2011 01:45:43 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHrNe-0003MW-9i for bug-coreutils@gnu.org; Thu, 05 May 2011 01:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHrNd-0004DE-EM for bug-coreutils@gnu.org; Thu, 05 May 2011 01:45:42 -0400 Received: from mail-px0-f171.google.com ([209.85.212.171]:56767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHrNd-0004D0-9t for bug-coreutils@gnu.org; Thu, 05 May 2011 01:45:41 -0400 Received: by pxi7 with SMTP id 7so1261194pxi.30 for ; Wed, 04 May 2011 22:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=xmwWpgrE19GGy5f3mFEhP5ffbVnynTNqHOHoJ+7pyZ0=; b=vgseAm9Kkca85WXFD7Mnqxe12YqZ++5xL/WrEc5h/yNTExSkl0gjZ+Bfcr3b+KxpDg maXoiBW4MHN+LmDWYHaOpwJNLqxdHhGvDq+++rku1PDChF0W3hOys4RXJeFcW/HD8ZMN gA7tUmvGiIwCewxHJh8APLLApCpCKb2ZwTyNE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=RxOJW62I7NqYpeJXourwqhnyweLUop+FimaOkJ42qHsbIFoK7mmOMXm0eapDgE1UUk 41lxAWw3JqCwhenaua+ZUP4G5WEcTX7Fcix5Qj1VmE2QdOQPFSomMUVzdKS4H4xz02k1 fTW2PnXQyrtXLQj27mrglXxq8ew4GCWXAyrbU= MIME-Version: 1.0 Received: by 10.68.20.106 with SMTP id m10mr2764902pbe.137.1304574339097; Wed, 04 May 2011 22:45:39 -0700 (PDT) Received: by 10.68.58.196 with HTTP; Wed, 4 May 2011 22:45:39 -0700 (PDT) Date: Thu, 5 May 2011 13:45:39 +0800 Message-ID: Subject: Strange problem for ls From: errik To: bug-coreutils@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 05 May 2011 02:01:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) Dears, Actually this is not a bug report, so sorry to do this because I don't know the mail address of Richard M. Stallman, and David MacKenzie. These days, there is a problem that trouble me so much. I write a simple code to get all the files under a directory and compile the code on RedHat 6 i686 machine. The code is as below: #include #include #include #include #include int main(int argc, char **argv) { printf("Try to list the directory: %s\n", argv[1]); DIR * dir = NULL; char * path = argv[1]; dir = opendir(path); errno = 0; if(NULL == dir) { printf("Failed to open the dir with errno: %d\n", errno); return -1; } struct dirent * dir_entry = NULL; while(dir_entry = readdir(dir)) { printf("file: %s\n", dir_entry->d_name); } printf("error :%d\n", errno); return 0; } After compiled the code on RedHat 6 32 bits machine and then copy the binary to RedHat 6 64 bits machine, it can work correctly when the parameter for the program is a local directory. But "readdir" always failed if the parameter is a cifs client directory, the errno is 12. Then I downloaded the souce code of "ls" from GNU site and compiled it on RedHat 6 32 bits, the binary can also works with cifs client directory. >From the code of ls, it also use opendir and readdir to list the directory. It's strange ls can work but my simple code can't work. Is there anyone can tell me the difference or forward the mail to Richard M. Stallman, and David MacKenzie? Thanks, Erik From debbugs-submit-bounces@debbugs.gnu.org Thu May 05 11:04:08 2011 Received: (at 8620) by debbugs.gnu.org; 5 May 2011 15:04:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QI064-0003fC-81 for submit@debbugs.gnu.org; Thu, 05 May 2011 11:04:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QI062-0003dn-3b for 8620@debbugs.gnu.org; Thu, 05 May 2011 11:04:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p45F40Mx025702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 May 2011 11:04:00 -0400 Received: from [10.3.113.2] ([10.3.113.2]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p45F3xF3028247; Thu, 5 May 2011 11:03:59 -0400 Message-ID: <4DC2BC5F.2070704@redhat.com> Date: Thu, 05 May 2011 09:03:59 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 To: errik Subject: Re: bug#8620: Strange problem for ls References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7ADC4ADD0392C0D4BE737895" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: 8620 Cc: 8620@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7ADC4ADD0392C0D4BE737895 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 05/04/2011 11:45 PM, errik wrote: > Dears, > Actually this is not a bug report, so sorry to do this because I > don't know the mail address of Richard M. Stallman, and David > MacKenzie. This is the correct address. 'ls --help' shows you the names of the original authors, not the current maintainers, but the original authors would have just pointed you to the current maintainers (at this address) in the first place. (Well, you could have used coreutils@gnu.org instead of bug-coreutils@gnu.org, in order to avoid raising it as a bug).= > These days, there is a problem that trouble me so much. I write a > simple code to get all the files under a directory and compile the > code on RedHat 6 i686 machine. The code is as below: >=20 > #include > #include > #include > #include > #include > int main(int argc, char **argv) > { > printf("Try to list the directory: %s\n", argv[1]); > DIR * dir =3D NULL; > char * path =3D argv[1]; > dir =3D opendir(path); > errno =3D 0; > if(NULL =3D=3D dir) > { > printf("Failed to open the dir with errno: %d\n", errno); > return -1; > } > struct dirent * dir_entry =3D NULL; > while(dir_entry =3D readdir(dir)) > { > printf("file: %s\n", dir_entry->d_name); You have to reset 'errno =3D 0;' here, before the next readdir() call... > } > printf("error :%d\n", errno); =2E..if you want errno to be valid here (since readdir is required to leave errno unchanged when successfully returning NULL, but printf is allowed to populate errno with junk on success). In other words, your code may be printing a spurious errno value that was left over from some other call, rather than an actual readdir failure. > return 0; > } >=20 > After compiled the code on RedHat 6 32 bits machine and then copy the > binary to RedHat 6 64 bits machine, it can work correctly when the > parameter for the program is a local directory. > But "readdir" always failed if the parameter is a cifs client > directory, the errno is 12. aka ENOMEM. Which is an odd value, but might be plausibly explained if you aren't compiling for LARGE_FILES. >=20 >=20 > Then I downloaded the souce code of "ls" from GNU site and compiled > it on RedHat 6 32 bits, the binary can also works with cifs client > directory. >=20 >>>From the code of ls, it also use opendir and readdir to list the direct= ory. >=20 >=20 > It's strange ls can work but my simple code can't work. ls takes measures to guarantee that off_t is 64-bits, even on 32-bit Linux; I don't see that you have taken those same measures. Plus, until you fix your programming bug of errno handling, all bets are off. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig7ADC4ADD0392C0D4BE737895 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNwrxfAAoJEKeha0olJ0NqHrQH/jaSxMBJUpmSHUZOA5t1Qoun DaYOBrflpyHCszmIoTLdNT1OE7vObOMHaqhcRyBd/Y6Z2xZG2eAtwRBsVt52eEJi 2b9LOUsli6AZtebEFS8Ffxtzb7TSmKkOgJI6IwzrHlqS1OxbHjZEc6hHPQ5xsy9T c21yQmbIrDpd1/P/t7r1kgmA74TIZ/L7b3VA1M/T6AGjAElZoHUkTms8rSjRuH+Y e8sSzm3Wl01zH8f7O5aoAHmM6slMX4mwNIk0aU1QXgtK49LJ0eBft4fJWfZL1/bb fRDxLdJJ10n0yk3npyC/BUivST3Qzy9m4zUSgAzKX/wtdyZ0Rj4j8xKW2s30XFY= =eJo2 -----END PGP SIGNATURE----- --------------enig7ADC4ADD0392C0D4BE737895-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 06 04:41:27 2011 Received: (at 8620) by debbugs.gnu.org; 6 May 2011 08:41:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QIGbH-0004ho-G1 for submit@debbugs.gnu.org; Fri, 06 May 2011 04:41:27 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QIGbE-0004hX-Kv for 8620@debbugs.gnu.org; Fri, 06 May 2011 04:41:25 -0400 Received: (qmail 38705 invoked from network); 6 May 2011 08:41:16 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 6 May 2011 08:41:16 -0000 Message-ID: <4DC3B40B.6000402@draigBrady.com> Date: Fri, 06 May 2011 09:40:43 +0100 From: =?GB2312?B?UKiiZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 Subject: Re: bug#8620: Strange problem for ls References: <4DC2BC5F.2070704@redhat.com> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 8620 Cc: 8620@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) tags 8620 notabug close 8620 On 06/05/11 07:50, errik wrote: > Hi All, > > It seems I can solve the issue by add compile option: > > -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 Just the latter. http://www.pixelbeat.org/programming/gcc/c_c++_notes.html#LFS I'm closing this... From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 08 02:13:14 2011 Received: (at control) by debbugs.gnu.org; 8 Aug 2011 06:13:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QqJ5O-0007bF-52 for submit@debbugs.gnu.org; Mon, 08 Aug 2011 02:13:14 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QqJ5G-0007b2-7a for control@debbugs.gnu.org; Mon, 08 Aug 2011 02:13:12 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 0A0356005B for ; Mon, 8 Aug 2011 08:12:04 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: close 8620 Date: Mon, 08 Aug 2011 08:12:04 +0200 Message-ID: <877h6ofn4b.fsf@rho.meyering.net> Lines: 2 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) tags 8620 notabug close 8620 From unknown Thu Sep 11 01:11:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 05 Sep 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator