Recently a tar.gz archive broke my script. Steps to reproduce:# this is a Python package distributed through PyPiwget https://pypi.python.org/packages/b3/e8/0a829f58ff6068f94edf74877f2e093aae945482c96ade683ef3cafdfcad/EasyExtend-3.0.2-py2.5.tar.gz# tar exist status is 0 (i.e. not a broken archive)tar -zxvf EasyExtend-3.0.2-py2.5.tar.gzls -l EasyExtend-3.0.2-py2.5Result:ls: cannot access 'EasyExtend-3.0.2-py2.5/scripts': Permission deniedls: cannot access 'EasyExtend-3.0.2-py2.5/setup.py': Permission deniedls: cannot access 'EasyExtend-3.0.2-py2.5/LICENSE.txt': Permission deniedls: cannot access 'EasyExtend-3.0.2-py2.5/PKG-INFO': Permission deniedls: cannot access 'EasyExtend-3.0.2-py2.5/EasyExtend': Permission deniedls: cannot access 'EasyExtend-3.0.2-py2.5/README.txt': Permission deniedtotal 0d????????? ? ? ? ?            ? EasyExtend-????????? ? ? ? ?            ? LICENSE.txt-????????? ? ? ? ?            ? PKG-INFO-????????? ? ? ? ?            ? README.txtd????????? ? ? ? ?            ? scripts-????????? ? ? ? ?            ? setup.pyThough everything was done under non-superuser account, umask was not applied to newly extracted files.Question: is it a bug, feature or an invalid archive?Question2: is there an elegant way to force default permissions on such files?UPD: my umask is 0002. sudo ls -l gives the right permissions:sudo ls -l EasyExtend-3.0.2-py2.5total 28drw-rw-r-- 7 username username 4096 Sep 19  2009 EasyExtend-rw-rw-r-- 1 username username 1559 May 16  2006 LICENSE.txt-rw-rw-r-- 1 username username  342 Sep 19  2009 PKG-INFO-rw-rw-r-- 1 username username  585 Aug 13  2008 README.txtdrw-rw-r-- 2 username username 4096 Sep 19  2009 scripts-rw-rw-r-- 1 username username 5296 Aug 15  2008 setup.py
tar extracts with invalid permissions - is it an intended behavior?
permissions;tar;umask
These are perfectly valid permissions, they just don't include letting you read them :). In terms of tar, surely it's a feature? But the archive sounds messed up.Re umask, I would assume the explanation here is correct; umask is purely a subtractive thing (or a bitmask, if you're a programmer). It doesn't make sense to say umask is not applied on the basis that there are missing permission bits.To grant executable permission for all directories, you can conveniently use chmod -R a+X EasyExtend-3.0.2-py2.5