|
|
Subscribe / Log in / New account

Bad Practice

Bad Practice

Posted Apr 24, 2025 16:42 UTC (Thu) by JanSoundhouse (subscriber, #112627)
Parent article: Some __nonstring__ turbulence

IMO its pretty hard to side with Linus on this one. Making last minute changes without even checking if its actually working is pretty bad practice. Does Linus not have of access to some kind of infrastructure that does the absolute minimal checks in the form of "does-it-compile"? Works on my machine, lets ship it!

Maybe someone can help and setup some basic actions for him on his github repo?


to post comments

Bad Practice

Posted Apr 25, 2025 6:49 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

Agreed. The number of times "oh, this is trivial" and skipped CI has bitten me is a significant percentage of the times I've done it. *Sometimes* it works, but that "this is trivial" judgement really hampers the self-review process for spotting actual issues. But eating crow when you screw up is not a fatal thing…accept it, learn from it, and move on.

Bad Practice

Posted Apr 25, 2025 8:14 UTC (Fri) by jlargentaye (subscriber, #75206) [Link]

I agree that, as presented, this is a particular poor showing from Torvalds.

> Maybe someone can help and setup some basic actions for him on his github repo?

Surely you're joking. Or are you unaware of his poor opinion of GitHub's every design decision? To make it clear, the GitHub Linux repo is offered only as a read-only mirror.

Bad Practice

Posted Apr 25, 2025 15:38 UTC (Fri) by rweikusat2 (subscriber, #117920) [Link] (5 responses)

This wasn't 'shipped'. It was a release candidate published so that others could test it, precisely to catch bugs which might only occur in environments different from the one the person who put together the release candidate used. Considering that the behavoir of GCC 15 and GCC 14 differs with regard to this particular kind of using an attribute, it's also not inappropriate to refert to the actual issue as a GCC 14 bug or at least a property of GCC 14 the GCC developers no longer consider useful.

Bad Practice

Posted Apr 25, 2025 16:19 UTC (Fri) by pbonzini (subscriber, #60935) [Link] (4 responses)

No, not at all. There is a set of supported GCC versions which is much larger than "whatever Linus has on his machine". If he didn't want to check what was in linux-next or on the mailing list he totally could have worked around the issue on his machine, but he shouldn't have pushed untested crap to the -rc.

Bad Practice

Posted Apr 25, 2025 17:21 UTC (Fri) by rweikusat2 (subscriber, #117920) [Link] (3 responses)

Then, what's your theory about the reason for this change of behaviour fromm GCC 14 to GCC 15 if it was neither a bugfix nor something the GCC developers considered a necessary improvement? Random mutation perhaps?

The very point of having a release candidate is to enable testing by others. It's not a release and bugs are expected.

Bad Practice

Posted Apr 25, 2025 18:21 UTC (Fri) by marcH (subscriber, #57642) [Link]

> The very point of having a release candidate is to enable testing by others. It's not a release and bugs are expected.

Come on, failure to compile (!) with everything except a pre-release GCC is absolutely not expected from a _release candidate_. Yes, people are expected to test release candidates and find bugs but they are not expected to waste everyone's time with that sort of issue in 2025. This steals from actual test time.

The Error of -Werror

Posted Apr 25, 2025 18:45 UTC (Fri) by mussell (subscriber, #170320) [Link]

So right now if you try to build the 6.15-rc3 tag with GCC 14 and CONFIG_WERROR, the error you will get is
/media/net/src/linux/drivers/acpi/tables.c:399:1: error: ‘nonstring’ attribute ignored on objects of type ‘const char[][4]’ [-Werror=attributes]

399 | static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst __nonstring = {

And the GCC documentation for nonstring, says that
The nonstring variable attribute specifies that an object or member declaration with type array of char, signed char, or unsigned char, or pointer to such a type is intended to store character arrays that do not necessarily contain a terminating NUL.
According to the C standard (and contrary to popular belief), char* and char[] are two distinct types as the latter has storage associated with it (ie. in .rodata) while the former is a single machine word (assuming pointers are represented by machine words.) What seems to have changed in GCC 15 is that you can now declare an array of char arrays as nonstring. On older compilers, trying to use an attribute where it can't be used gives a warning from -Wattributes, which is upgraded to an error by -Werror.

From my perspective, GCC did the right thing by allowing nonstring to be applied to char[][] since it aligns with programmers' expectations that char*[] and char[][] are basically the same. In fact, I consider <GCC 15's behaviour a bug and I see no reason not to backport this change to earlier versions. Really this is just -Werror doing -Werror things.

Bad Practice

Posted Apr 26, 2025 8:42 UTC (Sat) by jwakely (subscriber, #60262) [Link]

There's no GCC bug here. GCC 15 has a new feature, which isn't supported by GCC 14 so it gives a warning, which is escalated to breaking the build because of -Werror

Using new features needs to be gated on version checks or feature test macro checks (e.g. using __has_attribute). This has nothing to do with whether you're using a snapshot from two weeks before the GCC 15 release or you're using the final GCC 15.1 release, the behaviour is the same, because it's not a bug in some unstable early development preview. It's the expected behaviour of GCC 15.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds