#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: normal Keywords:
Cc:

Description (last modified by pierre)

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 pierre, 15 months ago

Description: modified (diff)
Milestone: 11.411.3
Type: enhancementdefect

comment:2 by pierre, 15 months ago

The following sed seems to work:

sed -e '/install -m 644 $(LIBNEWT)/ s/^/#/' \
    -e '/$(LIBNEWT):/,/rv/ s/^/#/'          \
    -e 's/$(LIBNEWT)/$(LIBNEWTSH)/g'        \
    -i Makefile.in

This prevents also compiling the non "-fPIC" version of the library components.

comment:3 by pierre, 15 months ago

Resolution: fixed
Status: newclosed

Fixed at 1b45a47060

Note: See TracTickets for help on using tickets.