Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-line perl within bash confuses difft #750

Open
xkcd386at opened this issue Aug 6, 2024 · 0 comments
Open

multi-line perl within bash confuses difft #750

xkcd386at opened this issue Aug 6, 2024 · 0 comments

Comments

@xkcd386at
Copy link

Hi

I have a peculiar case which I have reduced to the following simple example. The summary would be shell script with a multi-line perl invocation inside it, confuses difft.

Note that "old.sh" and "old2.sh" differ only in making the multi-line into a single line. Similarly new.sh and new2.sh. Diffing the single line version does indeed come up with the expected "No syntactic changes" but diffing the multiline version does not.

(Note: I left one blank line before each command for visual clarity).

$ cat old.sh
#!/bin/bash
    out=$(
        perl -lne '
            next unless /\S/;
        ' | fzf -m | cut -f2,5
    )

$ cat new.sh
#!/bin/bash
out=$(
    perl -lne '
        next unless /\S/;
    ' | fzf -m | cut -f2,5
)

$ ./difft --display inline old.sh new.sh
new.sh --- Bash
File permissions changed from 100600 to 100700.
1    #!/bin/bash
2        out=$(
3            perl -lne '
4                next unless /\S/;
5            ' | fzf -m | cut -f2,5
   3     perl -lne '
   4         next unless /\S/;
   5     ' | fzf -m | cut -f2,5
   6 )


$ cat old2.sh
#!/bin/bash
    out=$(
        perl -lne ' next unless /\S/; ' | fzf -m | cut -f2,5
    )

$ cat new2.sh
#!/bin/bash
out=$(
    perl -lne ' next unless /\S/; ' | fzf -m | cut -f2,5
)

$ ./difft --display inline old2.sh new2.sh
new2.sh --- Bash
File permissions changed from 100600 to 100700.
No syntactic changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant