[pacman-dev] [PATCH] pmpkg: set default mode for files in sync packages
TarInfo objects default to mode 0644 while mkfile in util.py uses 0755, causing pacman warnings about differing permissions on tests involving package updates. Set the mode on TarInfo objects to 0755 unless the test specifies a different mode. Bug referenced in FS#30723. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- test/pacman/pmpkg.py | 2 ++ test/pacman/tests/mode001.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index 988c73f..250d45b 100644 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -160,6 +160,8 @@ def makepkg(self, path): info = tarfile.TarInfo(fileinfo["filename"]) if fileinfo["hasperms"]: info.mode = fileinfo["perms"] + else: + info.mode = 0755 if fileinfo["isdir"]: info.type = tarfile.DIRTYPE tar.addfile(info) diff --git a/test/pacman/tests/mode001.py b/test/pacman/tests/mode001.py index 4ec11e1..db886e7 100644 --- a/test/pacman/tests/mode001.py +++ b/test/pacman/tests/mode001.py @@ -9,4 +9,4 @@ self.addrule("PACMAN_RETCODE=0") for f in p.files: - self.addrule("FILE_MODE=%s|644" % f) + self.addrule("FILE_MODE=%s|755" % f) -- 1.8.2
On 03/04/13 10:30, Andrew Gregory wrote:
TarInfo objects default to mode 0644 while mkfile in util.py uses 0755, causing pacman warnings about differing permissions on tests involving package updates. Set the mode on TarInfo objects to 0755 unless the test specifies a different mode.
Bug referenced in FS#30723.
Hrm... I'd prefer to stick to "defaults" of 0755 for directories and 0644 for files. Not sure how difficult that is though. Also, if we must go this root, mode002.py needs adjusted to do something other than the default (or another test added). Allan
TarInfo objects default to mode 0644 while mkfile in util.py uses 0755 for directories, causing pacman warnings about differing permissions on tests involving package updates. Set the mode on TarInfo directory objects to 0755 unless the test specifies a different mode. Bug referenced in FS#30723. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- test/pacman/pmpkg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index 988c73f..9b3147a 100644 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -160,6 +160,8 @@ def makepkg(self, path): info = tarfile.TarInfo(fileinfo["filename"]) if fileinfo["hasperms"]: info.mode = fileinfo["perms"] + elif fileinfo["isdir"]: + info.mode = 0755 if fileinfo["isdir"]: info.type = tarfile.DIRTYPE tar.addfile(info) -- 1.8.2.1
open() is the standard way to open a file in python. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- test/pacman/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pacman/util.py b/test/pacman/util.py index be99cd5..65540ed 100644 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -100,7 +100,7 @@ def mkfile(base, name, data=""): def writedata(filename, data): if isinstance(data, list): data = "\n".join(data) - fd = file(filename, "w") + fd = open(filename, "w") if data: fd.write(data) if data[-1] != "\n": -- 1.8.2.1
participants (2)
-
Allan McRae
-
Andrew Gregory