From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5BEA93856943; Thu, 11 Aug 2022 15:11:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BEA93856943 From: "panxh_ran at 163 dot com" To: elfutils-devel@sourceware.org Subject: [Bug tools/28729] After eu-ar -r added file into archive, it changes file permission Date: Thu, 11 Aug 2022 15:11:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: tools X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: panxh_ran at 163 dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 15:11:43 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28729 --- Comment #2 from panxiaohe --- When eu-ar generates archive files=EF=BC=8Cnumbers of target file's permiss= ion which are writen in archive file are octal numbers. But "eu -ar -tv archive" and "eu-ar -x archive" commands treat numbers as decimalism. So it seems that "= eu -ar -tv archive" and "eu-ar -x archive" commands change file permission. The following file is the example of archive file. 100600(octal number) is = the permission of test1.txt. # cat test.a ! test1.txt/ 1659685099 0 0 100600 14 ` dalfjdalflala Anylze file permission in libelf/elf_begin.c. ----------------------------------------------------- 968 #define INT_FIELD(FIELD)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 \ 969 do=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 970 {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 971 char buf[sizeof (ar_hdr->FIELD) + 1];=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 972 const char *string =3D ar_hdr->FIELD;=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 973 if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] !=3D ' ')=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 \ 974 {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 975 *((char *) mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIEL= D))) \ 976 =3D '\0';=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 977 string =3D buf;=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 \ 978 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 979 if (sizeof (elf_ar_hdr->FIELD) <=3D sizeof (long int))=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 \ 980 elf_ar_hdr->FIELD =3D (__typeof (elf_ar_hdr->FIELD)) atol (str= ing);=20 \ 981 else=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 982 elf_ar_hdr->FIELD =3D (__typeof (elf_ar_hdr->FIELD)) atoll (st= ring); \ 983 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ 984 while (0) 985 986 INT_FIELD (ar_date); 987 INT_FIELD (ar_uid); 988 INT_FIELD (ar_gid); 989 INT_FIELD (ar_mode); 990 INT_FIELD (ar_size); ----------------------------------------------------- Use file permission in libelf/elf_begin.c. ----------------------------------------------------- 551 printf ("%c%c%c%c%c%c%c%c%c %u/%u %6ju %s %s\n", 552 (arhdr->ar_mode & S_IRUSR) ? 'r' : '-', 553 (arhdr->ar_mode & S_IWUSR) ? 'w' : '-', 554 (arhdr->ar_mode & S_IXUSR) 555 ? ((arhdr->ar_mode & S_ISUID) ? 's' : 'x') 556 : ((arhdr->ar_mode & S_ISUID) ? 'S' : '-'), 557 (arhdr->ar_mode & S_IRGRP) ? 'r' : '-', 558 (arhdr->ar_mode & S_IWGRP) ? 'w' : '-', 559 (arhdr->ar_mode & S_IXGRP) 560 ? ((arhdr->ar_mode & S_ISGID) ? 's' : 'x') 561 : ((arhdr->ar_mode & S_ISGID) ? 'S' : '-'), 562 (arhdr->ar_mode & S_IROTH) ? 'r' : '-', 563 (arhdr->ar_mode & S_IWOTH) ? 'w' : '-', 564 (arhdr->ar_mode & S_IXOTH) 565 ? ((arhdr->ar_mode & S_ISVTX) ? 't' : 'x') 566 : ((arhdr->ar_mode & S_ISVTX) ? 'T' : '-'), 567 arhdr->ar_uid, 568 arhdr->ar_gid, 569 (uintmax_t) arhdr->ar_size, 570 datestr, 571 arhdr->ar_name); ----------------------------------------------------- --=20 You are receiving this mail because: You are on the CC list for the bug.=