GNU bug report logs - #24248
[patch] avoid duplicate definition of global variable presume_output_tty

Previous Next

Package: diffutils;

Reported by: Hanno Böck <hanno <at> hboeck.de>

Date: Wed, 17 Aug 2016 01:19:02 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

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 24248 in the body.
You can then email your comments to 24248 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#24248; Package diffutils. (Wed, 17 Aug 2016 01:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hanno Böck <hanno <at> hboeck.de>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Wed, 17 Aug 2016 01:19:02 GMT) Full text and rfc822 format available.

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

From: Hanno Böck <hanno <at> hboeck.de>
To: bug-diffutils <at> gnu.org
Subject: [patch] avoid duplicate definition of global variable
 presume_output_tty
Date: Wed, 17 Aug 2016 03:17:52 +0200
[Message part 1 (text/plain, inline)]
Hi,

The variable presume_output_tty is defined both in the diff.h header
and the file util.c (which includes diff.h).

The diff.h file makes sure that the variable is declared as external
except when it's included by the main program diff.c. But as it's also
declared in util.c we end up having two non-external declarations of it.

Traditionally gcc has allowed this behavior, which is probably the
reason it has not been spottet before, but it's not correct C. One can
get a more strict behavior here by passing -fno-common to the CFLAGS and
LDFLAGS and then linking will fail.

The solution is simple: Remove the superfluous declaration in util.c,
see attached patch. Please apply.

-- 
Hanno Böck
https://hboeck.de/

mail/jabber: hanno <at> hboeck.de
GPG: FE73757FA60E4E21B937579FA5880072BBB51E42
[diffutils-duplicate-definition-presume_output_tty.patch (text/x-patch, attachment)]
[Message part 3 (application/pgp-signature, inline)]

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 17 Aug 2016 05:10:02 GMT) Full text and rfc822 format available.

Notification sent to Hanno Böck <hanno <at> hboeck.de>:
bug acknowledged by developer. (Wed, 17 Aug 2016 05:10:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Hanno Böck <hanno <at> hboeck.de>
Cc: 24248-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24248: [patch] avoid duplicate definition of
 global variable presume_output_tty
Date: Tue, 16 Aug 2016 22:09:18 -0700
[Message part 1 (text/plain, inline)]
On Tue, Aug 16, 2016 at 6:17 PM, Hanno Böck <hanno <at> hboeck.de> wrote:
> Hi,
>
> The variable presume_output_tty is defined both in the diff.h header
> and the file util.c (which includes diff.h).
>
> The diff.h file makes sure that the variable is declared as external
> except when it's included by the main program diff.c. But as it's also
> declared in util.c we end up having two non-external declarations of it.
>
> Traditionally gcc has allowed this behavior, which is probably the
> reason it has not been spottet before, but it's not correct C. One can
> get a more strict behavior here by passing -fno-common to the CFLAGS and
> LDFLAGS and then linking will fail.
>
> The solution is simple: Remove the superfluous declaration in util.c,
> see attached patch. Please apply.

Good catch. Thank you!
I will look into adding -fno-common when it is accepted.
Here's the patch I expect to push soon:
[duplicate-defn-of-presume_output_tty.diff (text/plain, attachment)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#24248; Package diffutils. (Wed, 17 Aug 2016 05:23:01 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Hanno Böck <hanno <at> hboeck.de>
Cc: 24248 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24248: [patch] avoid duplicate definition of
 global variable presume_output_tty
Date: Tue, 16 Aug 2016 22:22:28 -0700
[Message part 1 (text/plain, inline)]
On Tue, Aug 16, 2016 at 10:09 PM, Jim Meyering <jim <at> meyering.net> wrote:
...
> I will look into adding -fno-common when it is accepted.

Here's the patch for that:
[diff-fno-common.diff (text/plain, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 14 Sep 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 337 days ago.

Previous Next


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