public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* inside /bin/tar: cannot change mode
@ 2023-05-24 18:18 Denis Excoffier
  2023-05-25  7:52 ` Brian Inglis
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Excoffier @ 2023-05-24 18:18 UTC (permalink / raw)
  To: cygwin; +Cc: Denis Excoffier

Hello,
I have an error (about symlinks it seems) that i have never met in years: Cannot change mode.
Apart from this message (and return code != 0), the ’tar extract’ is ok.


% uname -a
CYGWIN_NT-10.0-17763 {edited} 3.5.0-0.295.g3bee68248fc8.x86_64 2023-05-01 17:58 UTC x86_64 Cygwin
% cd /tmp; rm -rf mytest mytest.tar
% mkdir mytest
% ln -s b mytest/a
% /bin/tar cf /tmp/mytest.tar mytest
% /bin/tar tvf /tmp/mytest.tar
drwxr-xr-x {edited}/{edited} 0 2023-05-24 13:12 mytest/
lrwxrwxrwx {edited}/{edited} 0 2023-05-24 13:12 mytest/a -> b
% rm -rf mytest
% /bin/tar xf /tmp/mytest.tar
/bin/tar: mytest/a: Cannot change mode to rwxr-xr-x: Not a directory
/bin/tar: Exiting with failure status due to previous errors
% echo $status
2
%

/tmp is under ntfs filesystem, all packages are up to date (e.g. /bin/tar --version is 1.34).

Regards,

Denis Excoffier.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: inside /bin/tar: cannot change mode
  2023-05-24 18:18 inside /bin/tar: cannot change mode Denis Excoffier
@ 2023-05-25  7:52 ` Brian Inglis
  2023-05-26  4:52   ` Denis Excoffier
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2023-05-25  7:52 UTC (permalink / raw)
  To: cygwin

On 2023-05-24 12:18, Denis Excoffier via Cygwin wrote:
> I have an error (about symlinks it seems) that i have never met in years: Cannot change mode.
> Apart from this message (and return code != 0), the ’tar extract’ is ok.
> % uname -a
> CYGWIN_NT-10.0-17763 {edited} 3.5.0-0.295.g3bee68248fc8.x86_64 2023-05-01 17:58 UTC x86_64 Cygwin
> % cd /tmp; rm -rf mytest mytest.tar
> % mkdir mytest
> % ln -s b mytest/a
> % /bin/tar cf /tmp/mytest.tar mytest
> % /bin/tar tvf /tmp/mytest.tar
> drwxr-xr-x {edited}/{edited} 0 2023-05-24 13:12 mytest/
> lrwxrwxrwx {edited}/{edited} 0 2023-05-24 13:12 mytest/a -> b
> % rm -rf mytest
> % /bin/tar xf /tmp/mytest.tar
> /bin/tar: mytest/a: Cannot change mode to rwxr-xr-x: Not a directory
> /bin/tar: Exiting with failure status due to previous errors
> % echo $status
> 2
> %
> /tmp is under ntfs filesystem, all packages are up to date (e.g. /bin/tar --version is 1.34).

I recently got this during a package update build, when it decided to tar a 
build directory, which contained only symlinks to files in the src directory, 
which the tar did not include, which would have created many dangling symlinks.

I fixed the issue by adding -h, --dereference to give chf and tar real files.

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: inside /bin/tar: cannot change mode
  2023-05-25  7:52 ` Brian Inglis
@ 2023-05-26  4:52   ` Denis Excoffier
  2023-05-26  6:27     ` Brian Inglis
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Excoffier @ 2023-05-26  4:52 UTC (permalink / raw)
  To: Brian Inglis, cygwin; +Cc: Denis Excoffier



> On 2023-05-25 09:52, Brian Inglis via Cygwin wrote:
> 
> On 2023-05-24 12:18, Denis Excoffier via Cygwin wrote:
>> I have an error (about symlinks it seems) that i have never met in years: Cannot change mode.
>> Apart from this message (and return code != 0), the ?tar extract? is ok.
>> % uname -a
>> CYGWIN_NT-10.0-17763 {edited} 3.5.0-0.295.g3bee68248fc8.x86_64 2023-05-01 17:58 UTC x86_64 Cygwin
>> % cd /tmp; rm -rf mytest mytest.tar
>> % mkdir mytest
>> % ln -s b mytest/a
>> % /bin/tar cf /tmp/mytest.tar mytest
>> % /bin/tar tvf /tmp/mytest.tar
>> drwxr-xr-x {edited}/{edited} 0 2023-05-24 13:12 mytest/
>> lrwxrwxrwx {edited}/{edited} 0 2023-05-24 13:12 mytest/a -> b
>> % rm -rf mytest
>> % /bin/tar xf /tmp/mytest.tar
>> /bin/tar: mytest/a: Cannot change mode to rwxr-xr-x: Not a directory
>> /bin/tar: Exiting with failure status due to previous errors
>> % echo $status
>> 2
>> %
>> /tmp is under ntfs filesystem, all packages are up to date (e.g. /bin/tar --version is 1.34).
> 
> I recently got this during a package update build, when it decided to tar a 
> build directory, which contained only symlinks to files in the src directory, 
> which the tar did not include, which would have created many dangling symlinks.
> 
> I fixed the issue by adding -h, --dereference to give chf and tar real files.
> 

I don’t catch this. A symlink, dangling or not, is a normal file. In any case, the problem is the
same if the symlink target is a member in the archive. See for example

% mkdir -p /tmp/mytest2; cd /tmp/mytest2
% tar xf cygwin-devel-3.5.0-0.295.g3bee68248fc8.tar.xz
/bin/tar: usr/lib/libg.a: Cannot change mode to rwxr-xr-x: Not a directory
/bin/tar: Exiting with failure status due to previous errors
%

I add that my symlinks are default ones, i.e. JUNCTIONS.

Denis Excoffier.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: inside /bin/tar: cannot change mode
  2023-05-26  4:52   ` Denis Excoffier
@ 2023-05-26  6:27     ` Brian Inglis
  2023-05-28  4:21       ` Brian Inglis
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2023-05-26  6:27 UTC (permalink / raw)
  To: cygwin; +Cc: Denis Excoffier

On 2023-05-25 22:52, Denis Excoffier wrote:
>> On 2023-05-25 09:52, Brian Inglis via Cygwin wrote:
>> On 2023-05-24 12:18, Denis Excoffier via Cygwin wrote:
>>> I have an error (about symlinks it seems) that i have never met in years: Cannot change mode.
>>> Apart from this message (and return code != 0), the ?tar extract? is ok.
>>> % uname -a
>>> CYGWIN_NT-10.0-17763 {edited} 3.5.0-0.295.g3bee68248fc8.x86_64 2023-05-01 17:58 UTC x86_64 Cygwin
>>> % cd /tmp; rm -rf mytest mytest.tar
>>> % mkdir mytest
>>> % ln -s b mytest/a
>>> % /bin/tar cf /tmp/mytest.tar mytest
>>> % /bin/tar tvf /tmp/mytest.tar
>>> drwxr-xr-x {edited}/{edited} 0 2023-05-24 13:12 mytest/
>>> lrwxrwxrwx {edited}/{edited} 0 2023-05-24 13:12 mytest/a -> b
>>> % rm -rf mytest
>>> % /bin/tar xf /tmp/mytest.tar
>>> /bin/tar: mytest/a: Cannot change mode to rwxr-xr-x: Not a directory
>>> /bin/tar: Exiting with failure status due to previous errors
>>> % echo $status
>>> 2
>>> %
>>> /tmp is under ntfs filesystem, all packages are up to date (e.g. /bin/tar --version is 1.34).

>> I recently got this during a package update build, when it decided to tar a
>> build directory, which contained only symlinks to files in the src directory,
>> which the tar did not include, which would have created many dangling symlinks.
>> I fixed the issue by adding -h, --dereference to give chf and tar real files.

Sorry I failed to make my meaning clear.
The issue may be that tar can not apply file permissions to a symlink target 
which does not (yet) exist in the filesystem.

> I don’t catch this. A symlink, dangling or not, is a normal file. In any case, the problem is the
> same if the symlink target is a member in the archive. See for example
> % mkdir -p /tmp/mytest2; cd /tmp/mytest2
> % tar xf cygwin-devel-3.5.0-0.295.g3bee68248fc8.tar.xz
> /bin/tar: usr/lib/libg.a: Cannot change mode to rwxr-xr-x: Not a directory
> /bin/tar: Exiting with failure status due to previous errors

What is .../libg.a in the tar file; is it a symlink link or target?

> I add that my symlinks are default ones, i.e. JUNCTIONS.

What is your CYGWIN=winsymlinks:... setting: native or nativestrict?

I have no idea how tar is likely to view or handle a Windows junction, 
especially if it has not yet been created!

The *default* symlinks are *sys*:

"CYGWIN=winsymlinks:{lnk,native,nativestrict,sys}
If set to just winsymlinks or winsymlinks:lnk, Cygwin creates symlinks as 
Windows shortcuts with a special header and the R/O attribute set.
If set to winsymlinks:native or winsymlinks:nativestrict, Cygwin creates 
symlinks as native Windows symlinks on filesystems and OS versions supporting them.
The difference between winsymlinks:native and winsymlinks:nativestrict is this: 
If the filesystem supports native symlinks and Cygwin fails to create a native 
symlink for some reason, it will fall back to creating Cygwin default symlinks 
with winsymlinks:native, while with winsymlinks:nativestrict the symlink(2) 
system call will immediately fail.
If set to winsymlinks:sys, Cygwin creates symlinks as plain files with the 
system attribute, containing a magic cookie followed by the path to which the 
link points.
Note that this setting has no effect where Cygwin knows that the filesystem only 
supports a creating symlinks in a specific way.
For more information on symbolic links, see the section called “Symbolic links”.

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: inside /bin/tar: cannot change mode
  2023-05-26  6:27     ` Brian Inglis
@ 2023-05-28  4:21       ` Brian Inglis
  2023-05-29  8:13         ` Denis Excoffier
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2023-05-28  4:21 UTC (permalink / raw)
  To: cygwin; +Cc: Denis Excoffier

On 2023-05-26 00:27, Brian Inglis via Cygwin wrote:
> On 2023-05-25 22:52, Denis Excoffier wrote:
>>> On 2023-05-25 09:52, Brian Inglis via Cygwin wrote:
>>> On 2023-05-24 12:18, Denis Excoffier via Cygwin wrote:
>>>> I have an error (about symlinks it seems) that i have never met in years: 
>>>> Cannot change mode.
>>>> Apart from this message (and return code != 0), the ?tar extract? is ok.
>>>> % uname -a
>>>> CYGWIN_NT-10.0-17763 {edited} 3.5.0-0.295.g3bee68248fc8.x86_64 2023-05-01 
>>>> 17:58 UTC x86_64 Cygwin
>>>> % cd /tmp; rm -rf mytest mytest.tar
>>>> % mkdir mytest
>>>> % ln -s b mytest/a
>>>> % /bin/tar cf /tmp/mytest.tar mytest
>>>> % /bin/tar tvf /tmp/mytest.tar
>>>> drwxr-xr-x {edited}/{edited} 0 2023-05-24 13:12 mytest/
>>>> lrwxrwxrwx {edited}/{edited} 0 2023-05-24 13:12 mytest/a -> b
>>>> % rm -rf mytest
>>>> % /bin/tar xf /tmp/mytest.tar
>>>> /bin/tar: mytest/a: Cannot change mode to rwxr-xr-x: Not a directory
>>>> /bin/tar: Exiting with failure status due to previous errors
>>>> % echo $status
>>>> 2
>>>> %
>>>> /tmp is under ntfs filesystem, all packages are up to date (e.g. /bin/tar 
>>>> --version is 1.34).
> 
>>> I recently got this during a package update build, when it decided to tar a
>>> build directory, which contained only symlinks to files in the src directory,
>>> which the tar did not include, which would have created many dangling symlinks.
>>> I fixed the issue by adding -h, --dereference to give chf and tar real files.
> 
> Sorry I failed to make my meaning clear.
> The issue may be that tar can not apply file permissions to a symlink target 
> which does not (yet) exist in the filesystem.
> 
>> I don’t catch this. A symlink, dangling or not, is a normal file. In any case, 
>> the problem is the
>> same if the symlink target is a member in the archive. See for example
>> % mkdir -p /tmp/mytest2; cd /tmp/mytest2
>> % tar xf cygwin-devel-3.5.0-0.295.g3bee68248fc8.tar.xz
>> /bin/tar: usr/lib/libg.a: Cannot change mode to rwxr-xr-x: Not a directory
>> /bin/tar: Exiting with failure status due to previous errors
> 
> What is .../libg.a in the tar file; is it a symlink link or target?
> 
>> I add that my symlinks are default ones, i.e. JUNCTIONS.
> 
> What is your CYGWIN=winsymlinks:... setting: native or nativestrict?
> 
> I have no idea how tar is likely to view or handle a Windows junction, 
> especially if it has not yet been created!
> 
> The *default* symlinks are *sys*:
> 
> "CYGWIN=winsymlinks:{lnk,native,nativestrict,sys}
> If set to just winsymlinks or winsymlinks:lnk, Cygwin creates symlinks as 
> Windows shortcuts with a special header and the R/O attribute set.
> If set to winsymlinks:native or winsymlinks:nativestrict, Cygwin creates 
> symlinks as native Windows symlinks on filesystems and OS versions supporting them.
> The difference between winsymlinks:native and winsymlinks:nativestrict is this: 
> If the filesystem supports native symlinks and Cygwin fails to create a native 
> symlink for some reason, it will fall back to creating Cygwin default symlinks 
> with winsymlinks:native, while with winsymlinks:nativestrict the symlink(2) 
> system call will immediately fail.
> If set to winsymlinks:sys, Cygwin creates symlinks as plain files with the 
> system attribute, containing a magic cookie followed by the path to which the 
> link points.
> Note that this setting has no effect where Cygwin knows that the filesystem only 
> supports a creating symlinks in a specific way.
> For more information on symbolic links, see the section called “Symbolic links”.

Problem seems to be Cygwin 3.5.0 - reinstall Cygwin stable 3.4.6 and the problem 
goes away!
See other thread I just started.

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: inside /bin/tar: cannot change mode
  2023-05-28  4:21       ` Brian Inglis
@ 2023-05-29  8:13         ` Denis Excoffier
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Excoffier @ 2023-05-29  8:13 UTC (permalink / raw)
  To: cygwin; +Cc: Denis Excoffier


> On 2023-05-28 06:21, Brian Inglis wrote:
> 
> Problem seems to be Cygwin 3.5.0 - reinstall Cygwin stable 3.4.6 and the problem goes away!
> See other thread I just started.
Thank you for your help. I’ll stick to pre-2.5.0 for the moment.

Denis Excoffier.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-02 10:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 18:18 inside /bin/tar: cannot change mode Denis Excoffier
2023-05-25  7:52 ` Brian Inglis
2023-05-26  4:52   ` Denis Excoffier
2023-05-26  6:27     ` Brian Inglis
2023-05-28  4:21       ` Brian Inglis
2023-05-29  8:13         ` Denis Excoffier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).