[m-rev.] diff: fix a problem using mdb from cmd.exe on Windows

Julien Fischer jfischer at opturion.com
Fri Jan 12 18:14:35 AEDT 2024


Fix a problem using mdb from cmd.exe on Windows.

More generally, clean-up the various batch files we have.

scripts/mdb.bat.in:
     Ensure that the value of MERCURY_DEBUGGER_INIT environment variable
     does *not* include double quotes, otherwise the path to the mdbrc file
     will be incorrect.

scripts/*.bat.in:
     Require command extensions to be enabled. This is the default on
     all Windows systems we support; explicitly enabling them is just in case
     the user turns them off for some reason.

     Don't disable echoing twice.

     Quote the entire arugment to the set command; this should avoid double
     quotes ending up where we don't want them.

     Update copyright notices.

Julien.

diff --git a/scripts/mdb.bat.in b/scripts/mdb.bat.in
index 87bcbf6..4fbc51a 100644
--- a/scripts/mdb.bat.in
+++ b/scripts/mdb.bat.in
@@ -2,6 +2,7 @@
  rem @configure_input@
  rem ---------------------------------------------------------------------------
  rem Copyright (C) 2011 The University of Melbourne.
+rem Copyright (C) 2020, 2024 The Mercury team.
  rem This file may only be copied under the terms of the GNU General
  rem Public License - see the file COPYING in the Mercury distribution.
  rem ---------------------------------------------------------------------------
@@ -10,9 +11,11 @@ rem mdb.bat - Mercury debugger
  rem Usage: mdb [<options>] <executable> [<args>] ...
  rem
  rem ---------------------------------------------------------------------------
- at echo off
-setlocal

-set MERCURY_OPTIONS=%MERCURY_OPTIONS% -Di
-set MERCURY_DEBUGGER_INIT="@PREFIX@\lib\mercury\mdb\mdbrc"
+rem Do not export any local environment changes and ensure command extensions
+rem are enabled.
+setlocal enableextensions
+
+set "MERCURY_OPTIONS=%MERCURY_OPTIONS% -Di"
+set "MERCURY_DEBUGGER_INIT=@PREFIX@\lib\mercury\mdb\mdbrc"
  %*
diff --git a/scripts/mercury.bat.in b/scripts/mercury.bat.in
index a45d1c6..07cf14e 100644
--- a/scripts/mercury.bat.in
+++ b/scripts/mercury.bat.in
@@ -2,6 +2,7 @@
  rem @configure_input@
  rem ---------------------------------------------------------------------------
  rem Copyright (C) 2001, 2003, 2005, 2011 The University of Melbourne.
+rem Copyright (C) 2020, 2024 The Mercury team.
  rem This file may only be copied under the terms of the GNU General
  rem Public License - see the file COPYING in the Mercury distribution.
  rem ---------------------------------------------------------------------------
@@ -16,10 +17,11 @@ rem (We don't use that name because it conflicts with that of the Microsoft
  rem Management Console.)
  rem ---------------------------------------------------------------------------

-rem Don't export any local environment changes.
-setlocal
+rem Do not export any local environment changes and ensure command extensions
+rem are enabled.
+setlocal enableextensions

-set MERCURY_CONFIG_DIR="@CONFIG_LIBDIR@"
-set MERCURY_COMPILER="@PREFIX@\bin\mercury_compile"
+set "MERCURY_CONFIG_DIR=@CONFIG_LIBDIR@"
+set "MERCURY_COMPILER=@PREFIX@\bin\mercury_compile"

  %MERCURY_COMPILER% %*
diff --git a/scripts/mprof.bat.in b/scripts/mprof.bat.in
index 905d578..df4edc6 100644
--- a/scripts/mprof.bat.in
+++ b/scripts/mprof.bat.in
@@ -1,7 +1,8 @@
  @echo off
  rem @configure_input@
  rem ---------------------------------------------------------------------------
-rem Copyright (C), 2011 The University of Melbourne.
+rem Copyright (C) 2011 The University of Melbourne.
+rem Copyright (C) 2024 The Mercury team.
  rem This file may only be copied under the terms of the GNU General
  rem Public License - see the file COPYING in the Mercury distribution.
  rem ---------------------------------------------------------------------------
@@ -10,8 +11,10 @@ rem mprof - MercuryProfiler
  rem Use `mprof -h' for help.
  rem
  rem ---------------------------------------------------------------------------
- at echo off
-setlocal

-set MPROF="@PREFIX@\bin\mercury_profile"
+rem Do not export any local environment changes and ensure command extensions
+rem are enabled.
+setlocal enableextensions
+
+set "MPROF=@PREFIX@\bin\mercury_profile"
  %MPROF% %*



More information about the reviews mailing list