GNU bug report logs - #61193
'-D' option of diff 3.9 - #ifdef directives missing

Previous Next

Package: diffutils;

Reported by: Robert Webb <ro.webbdg <at> gmail.com>

Date: Tue, 31 Jan 2023 05:37:03 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61193 in the body.
You can then email your comments to 61193 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#61193; Package diffutils. (Tue, 31 Jan 2023 05:37:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Webb <ro.webbdg <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Tue, 31 Jan 2023 05:37:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Webb <ro.webbdg <at> gmail.com>
To: bug-diffutils <at> gnu.org
Subject: '-D' option of diff 3.9 - #ifdef directives missing
Date: Mon, 30 Jan 2023 19:02:43 -0800
[Message part 1 (text/plain, inline)]
Hi,
The merged output from 'diff -D' (v3.9) is missing the '#ifdef'
directives.  A test script and logs from runs with two versions of diff,
one not working, and the second older one working, follows.

-------------------------------------------------------------------------
#!/bin/sh
# diff_ifdef_example.sh   2023-01-30   rw
#
# The -D option (--ifdef) of 'diff' version 3.9 does not work correctly.
# The '#ifdef' directives are not included in the merged output.

diff -v |grep diff
seq 5 > c
for OPT in '' '-D ZZZ' '-u'  ;do
  printf '\n=== diff %s\n' "$OPT"
  sed 2,3d c  |diff $OPT c -
  done

-------------------------------------------------------------------------
openSUSE Tumbleweed 20230129
diff (GNU diffutils) 3.9

=== diff
2,3d1
< 2
< 3

=== diff -D ZZZ
1
2
3
4
5

=== diff -u
--- c 2023-01-30 16:29:06.165608569 -0800
+++ - 2023-01-30 16:29:06.188398585 -0800
@@ -1,5 +1,3 @@
 1
-2
-3
 4
 5

-------------------------------------------------------------------------
openSUSE Tumbleweed 20220312
diff (GNU diffutils) 3.8

=== diff
2,3d1
< 2
< 3

=== diff -D ZZZ
1
#ifndef ZZZ
2
3
#endif /* ! ZZZ */
4
5

=== diff -u
--- c 2023-01-30 16:32:59.516569839 -0800
+++ - 2023-01-30 16:32:59.529462800 -0800
@@ -1,5 +1,3 @@
 1
-2
-3
 4
 5

-- 
Robert Webb
[Message part 2 (text/html, inline)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#61193; Package diffutils. (Fri, 10 Feb 2023 22:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 61193 <at> debbugs.gnu.org (full text, mbox):

From: Robert Webb <ro.webbdg <at> gmail.com>
To: 61193 <at> debbugs.gnu.org
Subject: Re: '-D' option of diff 3.9 - #ifdef directives missing
Date: Fri, 10 Feb 2023 14:51:30 -0800
[Message part 1 (text/plain, inline)]
Here is a pass/fail test to compare diff versions:

    #!/bin/bash
    diff -D AAAA /dev/null <(echo A) \
      |cmp - <(printf '%s\n' '#ifdef AAAA' A '#endif /* AAAA */')

The diff in diffutils v3.8 passes.  Version 3.9 fails.
-- 
Robert Webb
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Fri, 10 Feb 2023 23:49:02 GMT) Full text and rfc822 format available.

Notification sent to Robert Webb <ro.webbdg <at> gmail.com>:
bug acknowledged by developer. (Fri, 10 Feb 2023 23:49:02 GMT) Full text and rfc822 format available.

Message #13 received at 61193-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Robert Webb <ro.webbdg <at> gmail.com>
Cc: 61193-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#61193: '-D' option of diff 3.9 - #ifdef
 directives missing
Date: Fri, 10 Feb 2023 15:47:53 -0800
[Message part 1 (text/plain, inline)]
Thanks for the bug report and test case. This is due to a "sizeof 
sizeof" typo I introduced in diff 3.9; sorry about that. I installed the 
attached to fix things and add a regression test.
[0001-diff-fix-bug-where-D-does-not-work.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Mar 2023 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.