Re: RFR: 8301197: Make sure use of printf is correct and actually needed [v3]

2025-04-07 Thread Erik Joelsson
On Fri, 4 Apr 2025 14:32:30 GMT, Magnus Ihse Bursie wrote: >> We have been sloppy in our use of `printf` in make code. Most of the time, >> we should really use `echo` instead. If we do need to use `printf`, we >> should never inline make or shell variables into the formatting string, >> since

Re: RFR: 8301197: Make sure use of printf is correct and actually needed [v3]

2025-04-07 Thread Magnus Ihse Bursie
On Mon, 7 Apr 2025 05:25:39 GMT, David Holmes wrote: >> No, there are embedded `\n` and that does not work with echo. I could split >> it into three consecutive lines but I don't think that would be a gain. > > Ah I see. So basically the only time we actually need `printf` as far as I > can see

Re: RFR: 8301197: Make sure use of printf is correct and actually needed [v3]

2025-04-06 Thread David Holmes
On Fri, 4 Apr 2025 13:35:22 GMT, Magnus Ihse Bursie wrote: >> make/common/modules/GensrcCommon.gmk line 45: >> >>> 43: $$(call MakeTargetDir) >>> 44: $(PRINTF) "jdk=%s\nfull=%s\nrelease=%s\n" \ >>> 45: $(VERSION_NUMBER) $(VERSION_STRING) $(VERSION_SHORT) > $$@ >> >>

RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Magnus Ihse Bursie
We have been sloppy in our use of `printf` in make code. Most of the time, we should really use `echo` instead. If we do need to use `printf`, we should never inline make or shell variables into the formatting string, since they may contain `%` which will be interpreted as formatting. Instead, w

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Magnus Ihse Bursie
On Fri, 4 Apr 2025 13:53:57 GMT, Erik Joelsson wrote: >> I'm not sure I agree. Why would: >> >> $$(ECHO) -n '$$($1_OVERVIEW_TEXT)' >> >> be better than >> >> $$(PRINTF) "%s" '$$($1_OVERVIEW_TEXT)' >> >> ? >> >> We're kind of squabbling over details here, and it really doesn't matter as >>

Re: RFR: 8301197: Make sure use of printf is correct and actually needed [v3]

2025-04-04 Thread Magnus Ihse Bursie
> We have been sloppy in our use of `printf` in make code. Most of the time, we > should really use `echo` instead. If we do need to use `printf`, we should > never inline make or shell variables into the formatting string, since they > may contain `%` which will be interpreted as formatting. In

Re: RFR: 8301197: Make sure use of printf is correct and actually needed [v2]

2025-04-04 Thread Magnus Ihse Bursie
> We have been sloppy in our use of `printf` in make code. Most of the time, we > should really use `echo` instead. If we do need to use `printf`, we should > never inline make or shell variables into the formatting string, since they > may contain `%` which will be interpreted as formatting. In

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Erik Joelsson
On Fri, 4 Apr 2025 13:41:17 GMT, Magnus Ihse Bursie wrote: >> I wasn't aware of that feature in `echo`, but I agree that if we are using >> printf just to omit the line break, then `echo -n` seems like a better >> choice. > > I'm not sure I agree. Why would: > > $$(ECHO) -n '$$($1_OVERVIEW_TEX

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Magnus Ihse Bursie
On Fri, 4 Apr 2025 07:17:16 GMT, Erik Joelsson wrote: >> `echo -n` ? > > I wasn't aware of that feature in `echo`, but I agree that if we are using > printf just to omit the line break, then `echo -n` seems like a better choice. I'm not sure I agree. Why would: $$(ECHO) -n '$$($1_OVERVIEW_TEXT

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Magnus Ihse Bursie
On Fri, 4 Apr 2025 02:35:07 GMT, David Holmes wrote: >> We have been sloppy in our use of `printf` in make code. Most of the time, >> we should really use `echo` instead. If we do need to use `printf`, we >> should never inline make or shell variables into the formatting string, >> since they

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-04 Thread Erik Joelsson
On Fri, 4 Apr 2025 02:23:23 GMT, David Holmes wrote: >> That would add an extra \n at the end. Maybe it does not matter so much, but >> I did not want to change anything. > > `echo -n` ? I wasn't aware of that feature in `echo`, but I agree that if we are using printf just to omit the line bre

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-03 Thread David Holmes
On Thu, 3 Apr 2025 13:36:16 GMT, Magnus Ihse Bursie wrote: > We have been sloppy in our use of `printf` in make code. Most of the time, we > should really use `echo` instead. If we do need to use `printf`, we should > never inline make or shell variables into the formatting string, since they

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-03 Thread David Holmes
On Thu, 3 Apr 2025 21:08:40 GMT, Magnus Ihse Bursie wrote: >> make/autoconf/help.m4 line 295: >> >>> 293: $ECHO "* HS debug level: $HOTSPOT_DEBUG_LEVEL" >>> 294: $ECHO "* JVM variants: $JVM_VARIANTS" >>> 295: $ECHO "* JVM features: " >> >> I believe this will now add a newline where t

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-03 Thread David Holmes
On Thu, 3 Apr 2025 21:07:50 GMT, Magnus Ihse Bursie wrote: >> make/Docs.gmk line 267: >> >>> 265:$$(call LogInfo, Creating overview.html for $1) >>> 266:$$(call MakeDir, $$(@D)) >>> 267:$$(PRINTF) "%s" '$$($1_OVERVIEW_TEXT)' > $$@ >> >> For my education, why isn't this j

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-03 Thread Magnus Ihse Bursie
On Thu, 3 Apr 2025 20:15:00 GMT, Mikael Vidstedt wrote: >> We have been sloppy in our use of `printf` in make code. Most of the time, >> we should really use `echo` instead. If we do need to use `printf`, we >> should never inline make or shell variables into the formatting string, >> since th

Re: RFR: 8301197: Make sure use of printf is correct and actually needed

2025-04-03 Thread Mikael Vidstedt
On Thu, 3 Apr 2025 13:36:16 GMT, Magnus Ihse Bursie wrote: > We have been sloppy in our use of `printf` in make code. Most of the time, we > should really use `echo` instead. If we do need to use `printf`, we should > never inline make or shell variables into the formatting string, since they