[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/27284] New: ar: wrong permissions on output file
From: |
ats-sourceware at offog dot org |
Subject: |
[Bug binutils/27284] New: ar: wrong permissions on output file |
Date: |
Sat, 30 Jan 2021 23:16:53 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27284
Bug ID: 27284
Summary: ar: wrong permissions on output file
Product: binutils
Version: 2.36
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: ats-sourceware at offog dot org
Target Milestone: ---
I've just run into an interesting problem when building plan9port with
binutils 2.36: it uses "ar rcs" to build static libraries, but one of
the libraries -- lib9.a, which has a very long list of objects -- ends
up with permission 0600 rather than the intended 0644.
Here's a script that reproduces the problem for me on amd64 GNU/Linux
with GCC 10.2.0:
-----
#!/bin/sh
echo "int x;" >t.c
gcc -c t.c
for i in $(seq 100 299); do
cp t.o $i.o
done
rm -f libt.a
ar rcs libt.a 1*.o
ls -l libt.a
rm -f libt.a
ar rcs libt.a [12]*.o
ls -l libt.a
-----
This produces the output:
-rw-r--r-- 1 root root 101072 Jan 29 22:23 libt.a
-rw------- 1 root root 202072 Jan 29 22:23 libt.a
Tracing through the ar code, this seems to be fallout from this change:
https://lists.gnu.org/archive/html/bug-binutils/2021-01/msg00089.html
In write_archive, with the shorter argument list, iarch->iostream is
non-NULL; with the longer list, iarch->iostream is NULL, and skip_stat
is set to TRUE, so the permissions don't get set.
It looks from the libbfd code like ->iostream can legitimately be NULL
while the file is open, so I think the new test in write_archive is
incorrect.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/27284] New: ar: wrong permissions on output file,
ats-sourceware at offog dot org <=