Okay, attached patch didn't work, I'll try an inline copy: From a0f86d54b51710ca0843dff6d7a9f7378d5ab780 Mon Sep 17 00:00:00 2001 From: Thomas Jahns <jahns@xxxxxxx> Date: Mon, 4 Sep 2023 15:17:28 +0200 Subject: [PATCH] autom4te: Parse arguments before creating temporary directory. * The order before always used the default value of $debug in the mktempdir call of General.pm. --- bin/autom4te.in | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/bin/autom4te.in b/bin/autom4te.in index 71d7e6a6..9f408cf2 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -383,16 +383,6 @@ Try '$me --help' for more information." $melt = 1 if $freeze; - # Names of the cache directory, cache directory index, trace cache - # prefix, and output cache prefix. If the cache is not to be - # preserved, default to a temporary directory (automatically removed - # on exit). - $cache = $tmp - unless $cache; - $icache = "$cache/requests"; - $tcache = "$cache/traces."; - $ocache = "$cache/output."; - # Normalize the includes: the first occurrence is enough, several is # a pain since it introduces a useless difference in the path which # invalidates the cache. And strip '.' which is implicit and always @@ -454,6 +444,22 @@ Try '$me --help' for more information." @ARGV = @argv; } +# setup_cache +# ------------------------ +# define cache-related variables which depend on both, command-line +# arguments and the actual temporary directory +sub setup_cache +{ + # Names of the cache directory, cache directory index, trace cache + # prefix, and output cache prefix. If the cache is not to be + # preserved, default to a temporary directory (automatically removed + # on exit). + $cache = $tmp + unless $cache; + $icache = "$cache/requests"; + $tcache = "$cache/traces."; + $ocache = "$cache/output."; +} # handle_m4 ($REQ, @MACRO) # ------------------------ @@ -997,13 +1003,14 @@ sub freeze ($) ## Main program. ## ## -------------- ## -mktmpdir ('am4t'); load_configuration ($ENV{'AUTOM4TE_CFG'} || "$pkgdatadir/autom4te.cfg"); load_configuration ("$ENV{'HOME'}/.autom4te.cfg") if exists $ENV{'HOME'} && -f "$ENV{'HOME'}/.autom4te.cfg"; load_configuration (".autom4te.cfg") if -f ".autom4te.cfg"; parse_args; +mktmpdir ('am4t'); +setup_cache; # Freezing does not involve the cache. if ($freeze) -- 2.30.2 > On Sep 4, 2023, at 15:23 , Thomas Jahns <jahns@xxxxxxx> wrote: > > Of course there was a dependency. But I think I managed to find a suitable change that again preserves the temporaries. Please see the attached patch vs. cb6fbab55de1e9660e110857ae248a70a8b48c5b and tell me if that needs further improvements or is acceptable as is. > > Kind regards, Thomas > > > >> On Sep 4, 2023, at 14:57 , Thomas Jahns <jahns@xxxxxxx> wrote: >> >> Following up on this, I think this is because autom4te calls mktmpdir before parsing command line arguments: >> >> ## -------------- ## >> ## Main program. ## >> ## -------------- ## >> >> mktmpdir ('am4t'); >> load_configuration ($ENV{'AUTOM4TE_CFG'} || "$pkgdatadir/autom4te.cfg"); >> load_configuration ("$ENV{'HOME'}/.autom4te.cfg") >> if exists $ENV{'HOME'} && -f "$ENV{'HOME'}/.autom4te.cfg"; >> load_configuration (".autom4te.cfg") >> if -f ".autom4te.cfg"; >> parse_args; >> >> In this order it creates the am4t... directory with the UNLINK option always being 1, i.e. !$debug while previously Autom4te::General had a custom END block that deleted the temporary files conditionally and hence used the value of $debug set by Autom4te::General::getopt. >> >> I'm not sure if load_configuration somehow needs the temporary directory or if parse_args could be moved to precede all of the main program. I'll try that next but wanted to keep you informed of my ongoing investigation. >> >> Kind regards, Thomas >> >> >> >>> On Sep 4, 2023, at 13:15 , Thomas Jahns <jahns@xxxxxxx <mailto:jahns@xxxxxxx>> wrote: >>> >>> Dear autoconf maintainers, >>> >>> when trying to port another piece of software to use autoconf 2.71 I noticed a problem I wanted to debug with the autoreconf --debug option. But it seems autoconf now deletes the temporary files in all paths. >>> >>> While the 2.69 version I'm currently using preserves files in /tmp, when swapping the PATH to use autoconf 2.71, autoconf always unlinks the files there (and removes the temporary directory) as verified with strace -f -e rmdir,unlink on Linux x86_64. >>> >>> I tried >>> >>> autoconf --debug --verbose >>> >>> in a minimal autoconf directory like this: >>> >>> $ autoconf --debug --verbose 2>&1 | grep /tmp >>> autom4te: formatting traces for `/tmp/am4tYtdOcp/dependencies': include, m4_include >>> autom4te: formatting traces for `/tmp/am4tYtdOcp/warnings': _m4_warn >>> autom4te: reading /tmp/am4tYtdOcp/warnings >>> $ ls /tmp/am4tYtdOcp >>> dependencies traces.m4 warnings >>> $ module load autoconf-2.71-gcc-6.3.0-rj5ute2 >>> $ autoconf --debug --verbose 2>&1 | grep /tmp >>> autom4te: formatting traces for '/tmp/am4toeE5oa/warnings': _m4_warn >>> autom4te: reading /tmp/am4toeE5oa/warnings >>> autom4te: formatting traces for '/tmp/am4toeE5oa/patterns': m4_pattern_allow, m4_pattern_forbid >>> $ ls /tmp/am4toeE5oa/ >>> ls: cannot access '/tmp/am4toeE5oa/': No such file or directory >>> $ cat configure.ac >>> AC_INIT([hello], [1.0]) >>> AC_CONFIG_AUX_DIR([build-aux]) >>> AC_OUTPUT >>> $ strace -f -e rmdir,unlink autoconf --debug --verbose 2>&1 | grep -E 'unlink|rmdir|/tmp' >>> autom4te: formatting traces for '/tmp/am4tciBmIE/dependencies': include, m4_include >>> autom4te: formatting traces for '/tmp/am4tciBmIE/warnings': _m4_warn >>> autom4te: reading /tmp/am4tciBmIE/warnings >>> unlink("traces.m4") = 0 >>> unlink("dependencies") = 0 >>> unlink("warnings") = 0 >>> rmdir("/tmp/am4tciBmIE") = 0 >>> $ ls /tmp/am4tciBmIE >>> ls: cannot access '/tmp/am4tciBmIE': No such file or directory >>> >>> Kind regards, >>> Thomas -- Thomas Jahns HPC-Group DKRZ GmbH, Department: Application software Deutsches Klimarechenzentrum Bundesstraße 45a D-20146 Hamburg Phone: +49-40-460094-151 Fax: +49-40-460094-270 Email: Thomas Jahns <jahns@xxxxxxx>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature