bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #65019] Let function segfaults when foreach return empty list


From: John Olsson
Subject: [bug #65019] Let function segfaults when foreach return empty list
Date: Tue, 12 Dec 2023 07:47:51 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?65019>

                 Summary: Let function segfaults when foreach return empty
list
                   Group: make
               Submitter: ermingol
               Submitted: Tue 12 Dec 2023 12:47:49 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.4
        Operating System: None
           Fixed Release: None
           Triage Status: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 12 Dec 2023 12:47:49 PM UTC By: John Olsson <ermingol>
The following Makefile segfaults when the return value from the foreach
function is assigned to the two local variables 'result' and 'rest' AND the
forach function return an empty list.

To reproduce the segmentation fault run the Makefile below in a folder which
does not contain the folder 'fum' with file 'foo.txt'. Once 'fum/foo.txt'
exist there is no segfault.

I have only verified this on CentOS 7.9.

define foobar
$(info foobar: $(1))
$(let file folderlist,$(1) $(2),\
      $(info file='$(file)'  folderlist='$(folderlist)')
      $(let result rest,\
            $(foreach folder,$(folderlist),\
                      $(wildcard $(folder)/$(file))),\
                      $(info result='$(result)' rest='$(rest)')))
endef

$(call foobar,foo.txt,fum)

.PHONY: all
all:
        @:








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65019>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]