Bug 21144

Summary: rpm-3.0.6_IBM_patch_002 popt/configure sed fix to remove POTFILES last backslash
Product: [Retired] Red Hat Linux Reporter: Paul Shearer <paulsh>
Component: poptAssignee: Jeff Johnson <jbj>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-11-20 22:19:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rpm-3.0.6_IBM_patch_002.txt Patch file none

Description Paul Shearer 2000-11-20 22:17:11 UTC
IBM SPTS:     254361

IBM PATCH:   rpm-3.0.6_IBM_patch_002

Submitter:      paulsh.com
                     Paul Shearer

Product:         Red Hat Linux
Version:         6.2
Component:    rpm-3.0.6
Platform:        All | i386
OS:               All
uname -a:      DYNIX/ptx eng2 4.0 V4.6.0 i386

Summary:

        popt/configure sed script does not remove backslash from last line

Description:

OVERVIEW DESCRIPTION:

        popt/configure sed script needs to also remove backslash from last line.
        Upgrade the sed script to match the one in popt/po/Makefile.in

STEPS TO REPRODUCE:

        This works:
        cd popt/po
        make POTFILES

        The make target uses the correct sed script:

        (sed -e '/^#/d' -e '/^[  ]*$$/d' \
                    -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
                | sed -e '$$s/\\$$//') > $@-t


        This does not work with popt/configure which uses the incorrect sed:

         sed -e "/^#/d" -e "/^\$/d" -e "s,.*,       $posrcprefix& \\\\," -e
         "\$s/\(.
         *\) \\\\/\1/" \
                 < $srcdir/po/POTFILES.in > po/POTFILES

        cd popt
        ./configure
        cd popt/po
        make
        Make: line 91: syntax error.  Stop.

        Because the popt/configure does not use the correct sed script
        like the one in popt/po/Makefile.in.  (see patch below)

        This popt/configure sed is wrong since the last sed command is
        applied to the last line (blank line in POTFILES)
        which has been deleted by earlier sed commands.
        So it may depend on what sed you use,
        but the sed man page documents that each sed command
        "applies in sequence all commands whose addresses
        select that pattern space" so this may vary with your sed.

        Thus the popt/configure does not remove the last backslash from
        the last nonblank line from POTFILES.

        This causes the make error when $(POTFILES) is expanded.

        Simple fix is to remove the last blank line from POTFILES.in
        and make sure the last line is nonblank, i.e. a filename.

        Complete fix is to replace the incorrect sed in the popt/configure
        with the correct one used in popt/po/Makefile.in.
        The patch below does that.

ACTUAL RESULTS:

        This does not work:
        cd popt
        ./configure

        cd popt/po
        make
        Make: line 91: syntax error.  Stop.

        The error is due to $(POTFILES) expanding with a \ on the last line
        due to the incorrect sed script in popt/configure


EXPECTED RESULTS:

        The expected results is to correctly produce the popt/po/Makefile
        assignment POTFILES without a backslash on the last line.

POTFILES = \
        ../findme.c \
        ../popt.c \
        ../poptconfig.c \
        ../popthelp.c \
        ../poptparse.c \
        ../test1.c

        The patch below fixes popt/configure to produce the above result.

BUILD DATE & PLATFORM:

        svr4 sed

ADDITIONAL BUILDS AND PLATFORMS:

        N/A

ADDITIONAL INFORMATION: (crash info)

        N/A

UNIX STACK TRACE:

        N/A

SAMPLE PATCH:

IBM patch sequence number: rpm-3.0.6_IBM_patch_002


List of files patched followed by RCS or SCCS ident lines.
==========================================================

popt/configure



Patch to fix the files
======================
*** 1.1 2000/11/02 09:33:16
--- popt/configure      2000/11/15 20:07:21
***************
*** 4226,4232 ****
       posrcprefix="../"
     fi
     rm -f po/POTFILES
!    sed -e "/^#/d" -e "/^\$/d" -e "s,.*,       $posrcprefix& \\\\," -e "\$s/\(.
*\) \\\\/\1/" \
        < $srcdir/po/POTFILES.in > po/POTFILES


--- 4226,4233 ----
       posrcprefix="../"
     fi
     rm -f po/POTFILES
!    (sed -e "/^#/d" -e "/^[    ]*\$/d"  -e "s,.*,      $posrcprefix& \\\\," |
!     sed -e "\$s/\(.*\) \\\\/\1/" ) \
        < $srcdir/po/POTFILES.in > po/POTFILES

Comment 1 Paul Shearer 2000-11-20 22:19:48 UTC
Created attachment 5582 [details]
rpm-3.0.6_IBM_patch_002.txt Patch file

Comment 2 Jeff Johnson 2001-08-24 17:20:31 UTC
This bug will be addresed after rpm-4.0.3 is released.