X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EF9E3894C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1610471713; bh=IPMyF/61bCX+4BCqJXFK6mZuligUegw4i8QehVHDSxM=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=dEyFVFzMOt33FKew6ThUmWFLaqEjKXz4V/6SyQI8+2pCeJE8hOuezor6zSMQx6FRL +3h/TTsfBGHb4LhSp5aU46WK4vbbr1GcOyIdpSlP+rDyUYIHTfFwpMeIVWczSXBPqv 0yEq1lKXAF9sqIR7HWBgTc2HojLVSnEkwT8CaAZ4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CD4883858031 Date: Tue, 12 Jan 2021 18:15:05 +0100 To: cygwin AT cygwin DOT com Subject: Re: tar 1.33 symlinks : Cannot change mode to... Message-ID: <20210112171505.GH59030@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com, Ken Brown References: <1dff3bac-a82e-f30a-a86d-a4dcc08c849b AT cornell DOT edu> <3a435fba-bdd2-535d-2161-f2fb75e2a4af AT cornell DOT edu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3a435fba-bdd2-535d-2161-f2fb75e2a4af@cornell.edu> X-Provags-ID: V03:K1:IsSS+vvJWvDIwUocVi8SStYeuZ6WY58oSt53SLVmijJ9ldjTtMD GPEYsx+Rv730u1ya3OilT8Ghby6b8Q1y/FrAGYpZac4B9BxPK8clt3ZSq/5NVrSD9gQo6+P ISR/N1U9FYmwsvKei3LNuVl9vD7QjKebsialjdPS/kEFQOi2P3U589jzTcZAA2+u7rla7Bz 4BkceHpyndrA44B1VVJtw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ChETW1hONsU=:CPk48qxU6uaOCzSo9Gur9r giukhyIPuSwPQp1ffOutOAajqUR3Be8MkES2x/dTKXXJBVmJiIF3xBkWEi2QLaGF/6K3VVHRq D5zhW+RgYVgArH3tVl1fMnkB0SfVTCafECIbWNTdjlRP6v8Igv5t3s1jKJzCuZ4E/FtaxZsYL 9C7sbAZi6tjWCOJ1UKBqjYh+gIoHKfceep8aY89+D5IEWUgKrfs1soA7DQQal0e6iwGro0aIu NDAE/e7bZT3oNjbPbF2dG28rWHs7/OrGPZbx5/Iy07HyxutCrtde7SiwaFQWG+F7VtxROnGxP CJA9fUeQ8KEcOM2p/996T1sFxA64YfIslKLer0cZxtoYMy4sH/gd02YO3vuOdc9qKjg6GsRJE w9Po3dDxvylOwPPrZBHPZFTopud2RSKVfwhj/bM7L2v1ELwy7CbWDPFnrnjx6rPL8NoEo0EBa Pmnytz5UVQ== X-Spam-Status: No, score=-99.3 required=5.0 tests=BAYES_00, BODY_8BITS, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 10CHFeoh022236 On Jan 12 11:55, Ken Brown via Cygwin wrote: > On 1/11/2021 6:50 PM, Ken Brown via Cygwin wrote: > > On 1/11/2021 2:57 PM, Morgan King via Cygwin wrote: > > > Hello, > > > > > > I am experiencing the same issue with tar and I am able to reproduce > > > it following the steps at: > > > https://lists.gnu.org/archive/html/bug-tar/2011-08/msg00006.html > > > > > > This issue only appears to occur when using 32-bit Cygwin, I am > > > unable to reproduce it using 64-bit Cygwin. > > > > I can confirm this.  Running the tar command under gdb shows a problem > > at gnu/fchmodat.c:94: > > > > 94            if (S_ISLNK (st.st_mode)) > > > > Here st is a stat structure for directory/1, so S_ISLNK() should be > > true.  It is indeed true on 64-bit Cygwin but not on 32-bit Cygwin.  > > Someone needs to look more closely and find out why this happened.  I'll > > try to do it tomorrow if no one beats me to it. > > This appears to be a bug in fstat in 32-bit Cygwin. Here's what I'm seeing > in gdb, using an unoptimized build of cygwin1.dll. There is a call to > fstatat in the tar source file gnu/fchmodat.c:87. This ultimately leads to > a call to fstat, whose definition in syscalls.cc is the following in the > 32-bit case: No, wait. struct stat == struct _stat64 since Cygwin 1.5.0! With Cygwin 1.5.0, the old entry point fstat was only retained to serve old 32 bit applications buil.t under Cygwin 1.3.x or earlier. Consequentially, newer 32 bit apps, built with Cygwin 1.5.0 or later, are redirected to fstat64, see NEW_FUNCTIONS in Makefile.in. If tar is actually calling fstat, something fishy is going on. > After the call to stat64_to_stat32, buf looks like this: > > (gdb) p/o *buf > $22 = {st_dev = 026106753173, st_ino = 017510000040000120777, st_mode = 01001, > st_nlink = 01, st_uid = 013777346014, st_gid = 03415154434, > st_rdev = 013777334323, st_size = 0161040234413777346014, st_atim = { > tv_sec = 0200000, tv_nsec = 0}, st_mtim = {tv_sec = 01, tv_nsec = 0}, > st_ctim = {tv_sec = 06533716, tv_nsec = 025000000}, st_blksize = 0, > st_blocks = 0, st_birthtim = {tv_sec = 0, tv_nsec = 03}} > > Note that many of the values have been corrupted or shifted. NHo, they are not. The problme is jsut that buf is defined as `struct stat' for API compatibility, but older (pre Cygwin-1.5.0) 32 bit apps expect the old 32 bit struct __stat32. Therefore, to evaluate the content of buf correctly, you have to cast it to struct __stat32 * in GDB. But... see above. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple