canonical / chisel

GNU Affero General Public License v3.0
270 stars 42 forks source link

deb/extract: Extract with umask set to 0 #34

Closed woky closed 1 year ago

woky commented 2 years ago

Permission bits passed to open(2) are AND-ed with current process umask. Set umask to 0 at the beginning of extractData() and restore it at the end, to extract files with desired permissions no matter what's the current process umask.

How does dpkg do it? It invokes tar binary to extract data.tar.gz, and tar sets current process umask to 0 if it's running as root. (See --no-same-permissions in tar(1)).

Also fix expected permissions of /tmp from 01775 to 01777.