On OpenBSD fchown(2) may deny changing the group of a file even if
the new group is the same as the old one. Test of devel/p5-Alien-Base fails due to xz failure. Not calling fchown(2) in cases where the group would not change anyway, fixes both. Patch discussed with upstream and cerry-picked from there. OK naddy@
This commit is contained in:
parent
505fabfbbb
commit
5d33bb2328
@ -1,8 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.38 2020/03/26 20:44:51 naddy Exp $
|
||||
# $OpenBSD: Makefile,v 1.39 2021/11/02 15:47:53 bluhm Exp $
|
||||
|
||||
COMMENT= LZMA compression and decompression tools
|
||||
|
||||
DISTNAME= xz-5.2.5
|
||||
REVISION= 0
|
||||
SHARED_LIBS= lzma 2.1 # 7.5
|
||||
CATEGORIES= archivers
|
||||
DPB_PROPERTIES= parallel
|
||||
|
24
archivers/xz/patches/patch-src_xz_file_io_c
Normal file
24
archivers/xz/patches/patch-src_xz_file_io_c
Normal file
@ -0,0 +1,24 @@
|
||||
$OpenBSD: patch-src_xz_file_io_c,v 1.3 2021/11/02 15:47:53 bluhm Exp $
|
||||
|
||||
fix a test failure in a Perl module
|
||||
https://github.com/PerlAlien/Alien-Build/issues/62
|
||||
https://git.tukaani.org/?p=xz.git;a=commitdiff;h=892b16cc282f5b4e1c49871b326f4db25c5b4d81
|
||||
|
||||
Index: src/xz/file_io.c
|
||||
--- src/xz/file_io.c.orig
|
||||
+++ src/xz/file_io.c
|
||||
@@ -368,7 +368,13 @@ io_copy_attrs(const file_pair *pair)
|
||||
|
||||
mode_t mode;
|
||||
|
||||
- if (fchown(pair->dest_fd, (uid_t)(-1), pair->src_st.st_gid)) {
|
||||
+ // With BSD directory semantics the new dest file may have a group
|
||||
+ // which does not belong to the user. If the src file has the same
|
||||
+ // group, nothing has to be done. Nevertheless OpenBSD fchown(2)
|
||||
+ // fails in this case which looks POSIX compliant. Linux does not
|
||||
+ // generate an error. As there is nothing to do, skip the syscall.
|
||||
+ if (pair->dest_st.st_gid != pair->src_st.st_gid &&
|
||||
+ fchown(pair->dest_fd, (uid_t)(-1), pair->src_st.st_gid)) {
|
||||
message_warning(_("%s: Cannot set the file group: %s"),
|
||||
pair->dest_name, strerror(errno));
|
||||
// We can still safely copy some additional permissions:
|
Loading…
Reference in New Issue
Block a user