| Summary: | Directory permissions are overwritten during install | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Yocto Project Subprojects] opkg | Reporter: | Paul Spangler <paul.spangler> | ||||
| Component: | opkg | Assignee: | Alejandro del Castillo <alejandro.delcastillo> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Undecided | ||||||
| Version: | 0.3.2 | ||||||
| Target Milestone: | 0.3.4 | ||||||
| Hardware: | x86 | ||||||
| OS: | x86_64 | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | Don't know | |||||
| Attachments: |
|
||||||
Fixed on commit 90e127aaf9a347fa6c48df321c2b3c013555fd87 (In reply to comment #1) > Fixed on commit 90e127aaf9a347fa6c48df321c2b3c013555fd87 The permissions do get preserved now, but it looks like the owner doesn't. The same test package still serves as a way to reproduce, but insert an extra chown prior to installing the package (steps assume a user named "user" exists on the system): Expectation (dpkg) ------------------ $ dpkg --version Debian 'dpkg' package management program version 1.18.4 (amd64). This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. $ sudo mkdir -p /dir/subdir $ sudo chmod 700 /dir/subdir $ sudo chmod 755 /dir $ sudo chown user:user /dir $ sudo chown user:user /dir/subdir $ ls -l / | grep dir drwxr-xr-x 3 user user 4096 Oct 16 11:34 dir $ ls -l /dir drwx------ 2 user user 4096 Oct 16 11:34 subdir $ sudo dpkg -i ~/perm-bug-1.0.0.0.ipk Selecting previously unselected package perm-bug. (Reading database ... 481088 files and directories currently installed.) Unpacking perm-bug (from .../perm-bug-1.0.0.0.ipk) ... Setting up perm-bug (1.0.0.0) ... $ ls -l / | grep dir drwxr-xr-x 3 user user 4096 Oct 16 11:34 dir $ ls -l /dir total 4 drwx------ 2 user user 4096 Oct 16 11:35 subdir Actual Result (opkg) -------------------- # opkg -v opkg version 0.3.4 (libsolv 0.6.24) # mkdir -p /dir/subdir # chmod 700 /dir/subdir # chmod 755 /dir # chown user:user /dir # chown user:user /dir/subdir # ls -l / | grep dir drwxr-xr-x 3 user user 1024 Oct 16 16:38 dir # ls -l /dir drwx------ 2 user user 1024 Oct 16 16:38 subdir # opkg install ~/perm-bug-1.0.0.0.ipk Installing perm-bug (1.0.0.0) on root Configuring perm-bug. # ls -l / | grep dir drwxr-xr-x 3 root root 1024 Jul 6 2016 dir # ls -l /dir drwx------ 2 root root 1024 Oct 16 16:39 subdir Note that dpkg preserved the user owner, while opkg used the owner from the package (root). this is an issue with libarchive. Paul already opened a PR to get this fixed [1] [1] https://github.com/libarchive/libarchive/pull/962 libarchive fix was merged on libarchive. Verified correct opkg behavior with libarchive fix. |
Created attachment 3271 [details] Example package to show behavior Installing a package that puts files in an already existing directory will overwrite the owner and permissions of the directory to whatever was specified in the package. This is in contrast to dpkg, which preserves the owner and permissions of the existing directory. See attached example package with Architecture all that installs a single text file to /dir/subdir. Expectation (dpkg) ------------------ $ dpkg --version Debian `dpkg' package management program version 1.16.1.2 (amd64). This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. $ sudo mkdir -p /dir/subdir $ sudo chmod 700 /dir/subdir $ sudo chmod 755 /dir $ ls -l / ... drwxr-xr-x 3 root root 4096 Jul 6 13:32 dir ... $ ls -l /dir drwx------ 2 root root 4096 Jul 6 13:32 subdir $ sudo dpkg -i ~/perm-bug-1.0.0.0.ipk Selecting previously unselected package perm-bug. (Reading database ... 1929438 files and directories currently installed.) Unpacking perm-bug (from .../perm-bug-1.0.0.0.ipk) ... Setting up perm-bug (1.0.0.0) ... $ ls -l / ... drwxr-xr-x 3 root root 4096 Jul 6 13:32 dir ... $ ls -l /dir/ drwx------ 2 root root 4096 Jul 6 13:35 subdir Actual Result (opkg) -------------------- # opkg -v opkg version 0.3.2 # mkdir -p /dir/subdir # chmod 700 /dir/subdir # chmod 755 /dir # ls -l / ... drwxr-xr-x 3 root root 4096 Jul 6 18:39 dir ... # ls -l /dir drwx------ 2 root root 4096 Jul 6 18:39 subdir # opkg install perm-bug-1.0.0.0.ipk Installing pkg perm-bug - 1.0.0.0 Configuring perm-bug. # ls -l / ... drwxrwxr-x 3 root root 4096 Jul 6 18:35 dir ... # ls -l /dir drwxrwxr-x 2 root root 4096 Jul 6 18:40 subdir