Opened 4 years ago
Closed 4 years ago
#17667 closed defect (fixed)
sed for newt may lead to a race condition
| Reported by: | pierre | Owned by: | blfs-book |
|---|---|---|---|
| Priority: | normal | Milestone: | 11.3 |
| Component: | BOOK | Version: | git |
| Severity: | medium | Keywords: | |
| Cc: |
Description (last modified by )
We have a sed in Makefile.in for newt to prevent building and installing a static library. The sed we have changes all occurrences of "$(LIBNEWT)" to "$(LIBNEWTSONAME)", but the Makefile contains:
$(LIBNEWT): $(LIBOBJS)
ar rv $@ $^
[...]
$(LIBNEWTSH): $(SHAREDOBJS)
$(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) $(SHAREDOBJS) $(LDFLAGS) $(LIBS)
ln -fs $(LIBNEWTSONAME) libnewt.$(SOEXT)
ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
The problem is that if the first target is done after the second (which may happen since the two targets are unrelated), then $(LIBNEWTSONAME) is a symlink to $(LIBNEWTSH) (the shared library), so that the "ar" command, which reads ar $(LIBNEWTSONAME) $(LIBOBJS), tries to make an archive into an already existing shared library, and complains about a non recognized format.
Change History (3)
comment:1 by , 4 years ago
| Description: | modified (diff) |
|---|---|
| Milestone: | 11.4 → 11.3 |
| Type: | enhancement → defect |
comment:2 by , 4 years ago
Note:
See TracTickets
for help on using tickets.

The following sed seems to work:
sed -e '/install -m 644 $(LIBNEWT)/ s/^/#/' \ -e '/$(LIBNEWT):/,/rv/ s/^/#/' \ -e 's/$(LIBNEWT)/$(LIBNEWTSH)/g' \ -i Makefile.inThis prevents also compiling the non "-fPIC" version of the library components.