AIX Open Source

 View Only

 gnu tar doesnt recurse

philip miloslavsky's profile image
philip miloslavsky posted Wed November 20, 2024 06:51 AM

We spun up a new aix box and tar doesnt recurse (it does on linux with same command)

pmilosla@REMOTE@aix72rel4-1:~/testaix> gtar -cvf test.tar.gz dist
dist/
pmilosla@REMOTE@aix72rel4-1:~/testaix> gtar -tvf test.tar.gz 
drwxr-xr-x pmilosla/develop  0 2024-11-20 06:28 dist/
pmilosla@REMOTE@aix72rel4-1:~/testaix> gtar -cvf test.tar.gz --recursion dist
dist/
pmilosla@REMOTE@aix72rel4-1:~/testaix> gtar -tvf test.tar.gz
drwxr-xr-x pmilosla/develop  0 2024-11-20 06:28 dist/
pmilosla@REMOTE@aix72rel4-1:~/testaix> ls dist
SNMP          csp  devuser  fop    install             lib     schema   ui
aixopenssl30  dev  docs     httpd  java_client.tar.gz  patrol  scripts
pmilosla@REMOTE@aix72rel4-1:~/testaix> pwd
/nethome/pmilosla/testaix
pmilosla@REMOTE@aix72rel4-1:~/testaix> gtar --version
tar (GNU tar) 1.35
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

philip miloslavsky's profile image
philip miloslavsky

1.33 seems to work and 1.35 does not

sudo dnf install tar-1.33-1.ppc seems to fix my issue

RESHMA KUMAR's profile image
RESHMA KUMAR

Recursive archiving of directories is the default behaviour of tar and it seems to be working.
Tried the following with tar 1.35,

# ls -R test
test:
ABOUT-NLS  AUTHORS  COPYING  build-aux  libwget

test/build-aux:
ar-lib  compile  config.guess  config.rpath  config.sub  install-sh  ltmain.sh

test/libwget:
Makefile.am  Makefile.in  atom_url.c  bar.c  base64.c  net.c  printf.c  thread.c

# tar -cvf test.tar.gz test
test/
test/ABOUT-NLS
test/AUTHORS
test/COPYING
test/build-aux/
test/build-aux/ar-lib
test/build-aux/compile
test/build-aux/config.guess
test/build-aux/config.rpath
test/build-aux/config.sub
test/build-aux/install-sh
test/build-aux/ltmain.sh
test/libwget/
test/libwget/Makefile.am
test/libwget/Makefile.in
test/libwget/atom_url.c
test/libwget/bar.c
test/libwget/base64.c
test/libwget/net.c
test/libwget/printf.c
test/libwget/thread.c

Is gtar a symbolic link to /opt/freeware/bin/tar in your case? 

philip miloslavsky's profile image
philip miloslavsky

pmilosla@REMOTE@p9aixdev4-openxl:~> dnf list tar
Last metadata expiration check: 22:47:18 ago on Wed Nov 20 07:30:18 EST 2024.
Installed Packages
tar.ppc                                               1.33-1                                               @AIX_Toolbox
Available Packages
tar.ppc                                               1.35-1                                               AIX_Toolbox 
[Errno 13] The file access permissions do not allow the specified action.: '/var/cache/dnf/expired_repos.json'
pmilosla@REMOTE@p9aixdev4-openxl:~> oslevel -s
7300-02-02-2420


pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls dist
SNMP          csp  devuser  fop    install             lib     schema   ui
aixopenssl30  dev  docs     httpd  java_client.tar.gz  patrol  scripts
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> rm test.tar.gz 
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> which gtar
/usr/local/bin/gtar
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls -lart /usr/local/bin/gtar
lrwxrwxrwx 1 root system 21 Jan 31  2024 /usr/local/bin/gtar -> /opt/freeware/bin/tar
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls -lart /opt/freeware/bin/tar
lrwxrwxrwx 1 root system 6 Feb 26  2021 /opt/freeware/bin/tar -> tar_64
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls -lart /opt/freeware/bin/tar_64
-rwxr-xr-x 1 root system 647536 Feb 26  2021 /opt/freeware/bin/tar_64

pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> /opt/freeware/bin/tar -cvf test.tar.gz dist
dist/
dist/java_client.tar.gz
dist/SNMP/
dist/csp/
dist/ui/
dist/dev/
dist/devuser/
dist/docs/
dist/fop/
dist/httpd/
dist/install/
dist/install/misc/
dist/install/irislib/
dist/install/irislib/big/
dist/install/irislib/big/IRIS.DAT.gz
dist/install/enslib/
dist/install/enslib/big/
dist/install/enslib/big/IRIS.DAT.gz
dist/lib/
dist/patrol/
dist/schema/
dist/scripts/
dist/aixopenssl30/

pmilosla@REMOTE@p9aixdev4-openxl:~> sudo dnf update tar
Last metadata expiration check: 22:50:16 ago on Wed Nov 20 07:30:18 EST 2024.
Dependencies resolved.
=======================================================================================================================
 Package                  Architecture             Version                      Repository                        Size
=======================================================================================================================
Upgrading:
 tar                      ppc                      1.35-1                       AIX_Toolbox                      1.5 M

Transaction Summary
=======================================================================================================================
Upgrade  1 Package

Total size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] tar-1.35-1.aix7.1.ppc.rpm: Already downloaded                                                               
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                               1/1 
  Upgrading        : tar-1.35-1.ppc                                                                                1/2 
  Running scriptlet: tar-1.35-1.ppc                                                                                1/2 
  Running scriptlet: tar-1.33-1.ppc                                                                                2/2 
  Cleanup          : tar-1.33-1.ppc                                                                                2/2 
  Verifying        : tar-1.35-1.ppc                                                                                1/2 
  Verifying        : tar-1.33-1.ppc                                                                                2/2 

Upgraded:
  tar-1.35-1.ppc                                                                                                       

Complete!




pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> rm test.tar.gz
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> /opt/freeware/bin/tar -cvf test.tar.gz dist
dist/
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls -lart /opt/freeware/bin/tar
lrwxrwxrwx 1 root system 6 Mar  6  2024 /opt/freeware/bin/tar -> tar_64
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> ls -lart /opt/freeware/bin/tar_64
-rwxr-xr-x 1 root system 653318 Mar  6  2024 /opt/freeware/bin/tar_64

Ranjit Ranjan's profile image
Ranjit Ranjan

Hi,

is this one system observation or are you seeing in multiple systems ?
If you have another AIX system, then let us know your observation.

Thanks
Ranjit

philip miloslavsky's profile image
philip miloslavsky

multiple systems - it originally happened on 72. But maybe our IT does similar things on boxes. Feel free to email me and set up a  debugging conf call.

Ranjit Ranjan's profile image
Ranjit Ranjan

okay.
1. let's compare the output of 1.33 and 1.35 under truss .
you can run like 'truss /opt/freeware/bin/tar -cvf test.tar.gz dist'

2. Also if you can take help from your IT team to figure out any file system corruption issues. 

philip miloslavsky's profile image
philip miloslavsky

Can you email me? first name . lastname intersystems.com.

testdir has directories test1 and test2

pmilosla@REMOTE@aix72rel4-1:~/testaix> /opt/freeware/bin/tar -cvf test.tar.gz testdir
testdir/
testdir/test1/
testdir/test2/

1.33:

testdir/kwrite(1, " t e s t d i r /", 8)                = 8

kwrite(1, "\n", 1)                              = 1
kfcntl(1, F_GETFL, 0x0000000000000008)          = 67110914
kopen(".", O_RDONLY|O_LARGEFILE)                = 5
kfcntl(5, F_GETFD, 0x0000000000000000)          = 0
kfcntl(5, F_SETFD, 0x0000000000000001)          = 0
fchdir(4)                                       = 0
statx("test1", 0x0FFFFFFFFFFFEF18, 176, 011)    = 0
fchdir(5)                                       = 0
close(5)                                        = 0
kopen(".", O_RDONLY|O_LARGEFILE)                = 5
kfcntl(5, F_GETFD, 0x0000000000000000)          = 0
kfcntl(5, F_SETFD, 0x0000000000000001)          = 0
fchdir(4)                                       = 0
kopen("test1", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 6
kfcntl(6, F_GETFD, 0x0000000000000000)          = 0
kfcntl(6, F_SETFD, 0x0000000000000001)          = 0
fchdir(5)                                       = 0
close(5)                                        = 0
fstatx(6, 0x0FFFFFFFFFFFEF18, 176, 010)         = 0
kfcntl(6, F_DUPFD, 0x0000000000000000)          = 5
close(6)                                        = 0
kfcntl(5, F_DUPFD, 0x0000000000000000)          = 6
close(5)                                        = 0
kopen(".", O_RDONLY|O_LARGEFILE)                = 5
kfcntl(5, F_GETFD, 0x0000000000000000)          = 0
kfcntl(5, F_SETFD, 0x0000000000000001)          = 0
kfcntl(6, F_DUPFD, 0x0000000000000000)          = 7
close(6)                                        = 0
fchdir(7)                                       = 0
statx(".", 0x0FFFFFFFFFFFE600, 176, 0)          = 0
kopen(".", O_RDONLY)                            = 6
getdirent(6, 0x0000000110046790, 4096)          = 48
lseek(6, 0, 0)                                  = 0
kfcntl(6, F_GETFD, 0x00000001100124D8)          = 0
kfcntl(6, F_SETFD, 0x0000000000000001)          = 0
fchdir(5)                                       = 0
close(7)                                        = 0
close(5)                                        = 0
getdirent(6, 0x0000000110046790, 4096)          = 48
getdirent(6, 0x0000000110046790, 4096)          = 0
testdir/test1/kwrite(1, " t e s t d i r / t e s t".., 14)       = 14

1.35:

kread(5, " s y s t e m : ! : 0 : r".., 4096)    = 0
kfcntl(5, 13, 0x0FFFFFFFFFFFE5D0)               = 0
kfcntl(5, F_GETFL, 0x0000000000000008)          = 67108864
close(5)                                        = 0
kioctl(1, 22528, 0x0000000000000000, 0x0000000000000000) = 0
testdir/kwrite(1, " t e s t d i r /", 8)                = 8

kwrite(1, "\n", 1)                              = 1
kfcntl(1, F_GETFL, 0x0000000000000008)          = 67110914
fstatx(4, 0x0FFFFFFFFFFFEEB0, 176, 0)           = 0
close(4)                                        = 0
kwrite(3, " t e s t d i r /\0\0\0\0".., 10240)  = 10240
close(3)                                        = 0
kfcntl(1, F_GETFL, 0x0000000000000008)          = 67110914
close(1)                                        = 0
close(2)                                        = 0
checkpnt_block(0x0000000000000000, 17)          = 0
checkpnt_block(0x0000000000000000, 17)          = 0
checkpnt_block(0x0000000000000000, 18)          = 0
checkpnt_block(0x0000000000000000, 18)          = 0
_exit(0)

Ayappan P's profile image
Ayappan P

tar command could be sensitive to some of the environment settings. 
What is the output of "env" and "locale" ? 

philip miloslavsky's profile image
philip miloslavsky

pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> env
SHELL=/bin/bash
LC__FASTMSG=true
ODMDIR=/etc/objrepos
PERL_MM_USE_DEFAULT=1
CLCMD_PASSTHRU=1
AUTHSTATE=compat
PWD=/nethome/pmilosla/testaix
LOGNAME=pmilosla
LDR_CNTRL=MAXDATA=0x80000000@DSA
TZ=America/New_York
HOME=/nethome/pmilosla
LANG=en_US

TERM=xterm-256color
USER=pmilosla
LOGIN=pmilosla
SHLVL=1
LOCPATH=/usr/lib/nls/loc
YPBIND_MAXWAIT=10
MAILMSG=[YOU HAVE NEW MAIL]
PS1=\h AIX-powerpc \W$ 

PATH=/usr/local/bin:/opt/IBM/xlC/16.1.0/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/usr/local/bin:/opt/freeware/sbin:/opt/freeware/bin:/opt/freeware/bin:/opt/IBM/openxlC/17.1.2/bin/

HOSTTYPE=rs6000
VENDOR=ibm
OSTYPE=aix
MACHTYPE=rs6000

NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/msg/%l.%c/%N:/usr/lib/nls/msg/%l.%c/%N.cat
pmilosla@REMOTE@p9aixdev4-openxl:~/testaix> locale
LANG=en_US
LC_COLLATE="en_US"
LC_CTYPE="en_US"
LC_MONETARY="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_MESSAGES="en_US"
LC_ALL=

philip miloslavsky's profile image
philip miloslavsky

1.35 tars up files on / fine but not on network mounted /nethome.

Ranjit Ranjan's profile image
Ranjit Ranjan

Thanks  Philip for updates.
So as per your  findings, issue is w.r.t network mounted file system . We will try to reproduce/debug. 

Ranjit Ranjan's profile image
Ranjit Ranjan

Hi Philip

Tried tar with NFS mounted file system. I am not able to repro . It's working fine.

# tar -cvf testdir.tar.gz testdir
testdir/
testdir/dir1/
testdir/dir1/1
testdir/dir1/2
testdir/dir1/3
testdir/dir1/4
testdir/dir1/5
testdir/dir2/
testdir/dir2/7
testdir/dir2/8
testdir/dir2/9
testdir/dir2/10
testdir/dir2/11

Were you able to debug further in your systems?

It will be good if you list out the steps to reproduce your observation. 

Thanks
Ranjit