[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36489: possible bug by sed?

From: Assaf Gordon
Subject: bug#36489: possible bug by sed?
Date: Thu, 4 Jul 2019 02:20:33 -0600
User-agent: Mutt/1.11.4 (2019-03-13)

tag 36489 moreinfo


On Wed, Jul 03, 2019 at 10:35:33AM -0400, Steven Abner wrote:
> Hi,
> Using:
> grep -rlI ~/Development/PheonixOS -e 'as_sys_types.h' | xargs sed -i
> 's@as_sys_types.h@as_types.h@g'
> on ElementaryOS did its job except it truncated a few files' last line. In
> otherwords, file ends up one line
> short, and had no replacement on that line.
>  Only found problem because of had identical copies on my mac, and did same
> thing, except BSD variant:
> grep -rlI ~/Development/Pheonix -e 'as_sys_types.h' | xargs sed -i ""
> 's@as_sys_types.h@as_types.h@g'
> Then I verify changes by using diff command. Several files on linux lost
> last line.
> As stated in subject, 'possible', because it could belong to 'xargs'?

We'll need a bit more information to be able to diagnose this issue.

which version of 'sed' are you using (try "sed --version").
If this isn't a recent version (4.7), can you also try
with version 4.7 ?

Is this reproducible?
Can you narrow it down to a single file using only "sed" (without
grep/xargs) ?
If so, can you share the file?
(To ease testing, you can add a backup extension to the "-i" parameter,
similar to bsd: "sed -i.bak [...]" - the original files will be saved).

A cursory attempt to run a similar command on my computer
did not show this issue, I tried with the following commands:

    for i in a b c d e ; \
        do ( seq 10 ; printf "AAA as_sys_types.h\n" ) > $i ; done

    grep -rlI ./ -e 'as_sys_types.h' \
        | xargs sed -i 's@as_sys_types.h@as_types.h@g'

 - assaf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]