* [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission
@ 2021-12-27 13:56 panxh_ran at 163 dot com
2021-12-27 13:57 ` [Bug tools/28729] " panxh_ran at 163 dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2021-12-27 13:56 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
Bug ID: 28729
Summary: After eu-ar -r added file into archive, it changes
file permission
Product: elfutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tools
Assignee: unassigned at sourceware dot org
Reporter: panxh_ran at 163 dot com
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
Created attachment 13885
--> https://sourceware.org/bugzilla/attachment.cgi?id=13885&action=edit
eu-ar -r changes file permission
After eu-ar -r added file into archive, it changes file permission
from -rw------- to -wsrwx---
But ar -r will not change file permission.
And if the following commands are repeatedly executed, the file permission
(test.o) will change all the time.
1.eu-ar -r libeuar.a test.o
2.eu-ar -tv libeuar.a
Please refer to the attachments.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tools/28729] After eu-ar -r added file into archive, it changes file permission
2021-12-27 13:56 [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission panxh_ran at 163 dot com
@ 2021-12-27 13:57 ` panxh_ran at 163 dot com
2022-08-11 15:11 ` panxh_ran at 163 dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2021-12-27 13:57 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
--- Comment #1 from panxiaohe <panxh_ran at 163 dot com> ---
Created attachment 13886
--> https://sourceware.org/bugzilla/attachment.cgi?id=13886&action=edit
eu-ar -r and -tv change file permission
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tools/28729] After eu-ar -r added file into archive, it changes file permission
2021-12-27 13:56 [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission panxh_ran at 163 dot com
2021-12-27 13:57 ` [Bug tools/28729] " panxh_ran at 163 dot com
@ 2022-08-11 15:11 ` panxh_ran at 163 dot com
2022-08-28 18:28 ` mark at klomp dot org
2022-09-14 19:01 ` mark at klomp dot org
3 siblings, 0 replies; 5+ messages in thread
From: panxh_ran at 163 dot com @ 2022-08-11 15:11 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
--- Comment #2 from panxiaohe <panxh_ran at 163 dot com> ---
When eu-ar generates archive files,numbers of target file's permission 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
!<arch>
test1.txt/ 1659685099 0 0 100600 14 `
dalfjdalflala
Anylze file permission in libelf/elf_begin.c.
-----------------------------------------------------
968 #define INT_FIELD(FIELD)
\
969 do
\
970 {
\
971 char buf[sizeof (ar_hdr->FIELD) + 1];
\
972 const char *string = ar_hdr->FIELD;
\
973 if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] != ' ')
\
974 {
\
975 *((char *) mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD)))
\
976 = '\0';
\
977 string = buf;
\
978 }
\
979 if (sizeof (elf_ar_hdr->FIELD) <= sizeof (long int))
\
980 elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atol (string);
\
981 else
\
982 elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atoll (string);
\
983 }
\
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);
-----------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tools/28729] After eu-ar -r added file into archive, it changes file permission
2021-12-27 13:56 [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission panxh_ran at 163 dot com
2021-12-27 13:57 ` [Bug tools/28729] " panxh_ran at 163 dot com
2022-08-11 15:11 ` panxh_ran at 163 dot com
@ 2022-08-28 18:28 ` mark at klomp dot org
2022-09-14 19:01 ` mark at klomp dot org
3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-08-28 18:28 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |mark at klomp dot org
CC| |mark at klomp dot org
--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
https://inbox.sourceware.org/elfutils-devel/20220828181034.115031-1-mark@klomp.org/
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tools/28729] After eu-ar -r added file into archive, it changes file permission
2021-12-27 13:56 [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission panxh_ran at 163 dot com
` (2 preceding siblings ...)
2022-08-28 18:28 ` mark at klomp dot org
@ 2022-09-14 19:01 ` mark at klomp dot org
3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2022-09-14 19:01 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
commit ee188125b10d1588a0536af033d7b7b1bbbaafaf
Author: Mark Wielaard <mark@klomp.org>
Date: Sun Aug 28 19:51:13 2022 +0200
libelf: Correctly decode ar_mode as octal string
ar_mode is encoded as an octal ascii string, not decimal. Add a new
OCT_FIELD macro to decode it.
https://sourceware.org/bugzilla/show_bug.cgi?id=28729
Signed-off-by: Mark Wielaard <mark@klomp.org>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-14 19:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 13:56 [Bug tools/28729] New: After eu-ar -r added file into archive, it changes file permission panxh_ran at 163 dot com
2021-12-27 13:57 ` [Bug tools/28729] " panxh_ran at 163 dot com
2022-08-11 15:11 ` panxh_ran at 163 dot com
2022-08-28 18:28 ` mark at klomp dot org
2022-09-14 19:01 ` mark at klomp dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).