bugmake - Bugs: bug #65360, Extend -p output with export...

 
 

bug #65360: Extend -p output with export status of each variable.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sat 24 Feb 2024 02:42:51 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  SCM Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 27 Feb 2024 03:11:51 AM UTC, comment #6: 

test3 is not very useful, though, because '/hello/' will match both 'hello' and 'export hello'.

Dmitry Goncharov <dgoncharov>
Tue 27 Feb 2024 03:10:17 AM UTC, comment #5: 

An alternative to fix2 can be printing "export" when a variable is exported regardless of the defaults, even for MAKEFLAGS, etc.
So, here is patch 3 that does that.

Dmitry Goncharov <dgoncharov>
Tue 27 Feb 2024 02:19:20 AM UTC, comment #4: 


> As for export, would it be better to use the make syntax for this


Sure.
i attached sv65360_fix2.diff and sv65360_test2.diff.
The output is make syntax


$ cat makefile
hello=world
all:;
$ ~/src/gmake/make//l64//make -r -p |grep -B1 hello
# makefile (from 'makefile', line 1)
unexport hello = world



> I'm not a fan of adding the "do not export" to comments for non-exported variables.  Non-exporting is the default and so we should just not say anything for non-exported variables.


There are variables which are exported by default, MAKEFLAGS, MAKE_TERMOUT, MAKE_TERMERR, and the variables inherited from env.
When should make print "export" for these?
If make prints "export" for these variable when these variables are exported, that'd be the opposite of what make does for regular make variables.
PATH and SHELL are even worse, because these variables are exported by default on certain operating systems only.

For now, this attached patch sv65360_fix2.diff prints either "export" or "unexport" for each variable. Unless there is an approach to deal with these variables differently.


$ cat makefile
unexport hello
all:;
$ hello=world ~/src/gmake/make//l64//make -r -p |grep -B1 hello
# environment
unexport hello = world


Dmitry Goncharov <dgoncharov>
Mon 26 Feb 2024 02:33:16 PM UTC, comment #3: 

Man I'm batting .000 today when it comes to Savannah markup :-/

Paul D. Smith <psmith>
Group administrator
Mon 26 Feb 2024 02:32:37 PM UTC, comment #2: 

I'm not a fan of adding the "do not export" to comments for non-exported variables.  Non-exporting is the default and so we should just not say anything for non-exported variables.

As for export, would it be better to use the make syntax for this, like:

+verbose+
# makefile (from 'Makefile', line 1)
export FOO = bar
-verbose-

?

Paul D. Smith <psmith>
Group administrator
Sat 24 Feb 2024 02:46:53 PM UTC, comment #1: 

This patch has -p print export status, special and conditional flags of each variable.


$ ls
makefile
$ cat makefile
hello?=one
all:;
$ ~/src/gmake/make/l64/make -rp |grep  -B1 -w MAKEFLAGS
# makefile special export
MAKEFLAGS = pr


Here make prints that MAKEFLAGS is a special variable and it is exported.



$ ~/src/gmake/make/l64/make -rp |grep  -B1 hello
# makefile conditional do not export (from 'makefile', line 1)
hello = one


Here make prints that hello is conditional and is not exported.

Dmitry Goncharov <dgoncharov>
Sat 24 Feb 2024 02:42:51 PM UTC, original submission:  

.

Dmitry Goncharov <dgoncharov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #55753:  sv65360_fix3.diff added by dgoncharov (2KiB - text/x-patch)
file #55754:  sv65360_test3.diff added by dgoncharov (4KiB - text/x-patch)
file #55751:  sv65360_fix2.diff added by dgoncharov (2KiB - text/x-patch)
file #55752:  sv65360_test2.diff added by dgoncharov (4KiB - text/x-patch)
file #55741:  sv65360_fix.diff added by dgoncharov (2KiB - text/x-patch)
file #55742:  sv65360_test.diff added by dgoncharov (4KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-27 dgoncharov Attached File- Added sv65360_fix3.diff, #55753
        Attached File- Added sv65360_test3.diff, #55754
    2024-02-27 dgoncharov Attached File- Added sv65360_fix2.diff, #55751
        Attached File- Added sv65360_test2.diff, #55752
    2024-02-24 dgoncharov Attached File- Added sv65360_fix.diff, #55741
        Attached File- Added sv65360_test.diff, #55742

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code