Search code examples
windowsvisual-studioperldata-distribution-serviceopendds

"Use of uninitialized value $prop_value in scalar chomp at configure line 473" OpenDDS configuration


I am trying to configure OpenDDS library with Windows 11 and Visual Studio 2022.

I ran the configure file through the Visual Studio Command Prompt and I get the following error.

Downloading ACE+TAO 2.2a with latest patches
Extracting archive ACE+TAO-2.2a_with_latest_patches_NO_makefiles.zip
Use of uninitialized value $prop_value in scalar chomp at configure line 473.
Couldn't get submodule.tools/rapidjson.openddsConfigureCommit from .gitmodules
Stopped at configure line 475.
ERROR: configure failed with errorcode 1

The configure.cmd file has the following code

@echo off
:: Win32 configure script wrapper for OpenDDS
:: Distributed under the OpenDDS License.
:: See: http://www.opendds.org/license.html

for %%x in (perl.exe) do set PERLPATH=%%~dp$PATH:x
if "x%PERLPATH%"=="x" (
  echo ERROR: perl.exe was not found.  This script requires Perl.
  exit /b 1
)
set PERLPATH=
perl configure %*
if %ERRORLEVEL% NEQ 0 (
  echo ERROR: configure failed with errorcode %errorlevel%
  exit /b %errorlevel%
)
if exist setenv.cmd call setenv.cmd

And I believe the configure file with perl is here https://github.com/objectcomputing/OpenDDS/blob/master/configure

I cross referenced this question "Use of uninitialized value in scalar chomp" in Perl, but I unfortunately do not code in Perl so I do not know how to solve this issue.


Solution

  • This is about a pipe file handle that has failed to read what it was supposed to, as described in the code you linked. Line 473 is inside this relatively brief subroutine:

    sub git_submodule_prop {
      my $path = shift;
      my $prop_name = shift;
      my $full_prop_name = "submodule.$path.$prop_name";
      open(my $fd, "-|", "git config --file .gitmodules --get $full_prop_name")
        or die("git_submodule_prop open failed: $!\nStopped");
      my $prop_value = <$fd>;
      close($fd);
      chomp($prop_value);
      if (!$prop_value) {
        die("Couldn't get $full_prop_name from .gitmodules\nStopped");
      }
      return $prop_value;
    }
    

    The error message says nothing especially noteworthy, except that the function chomp is used on an undefined value. The "real" error message comes below it:

    Couldn't get submodule.tools/rapidjson.openddsConfigureCommit from .gitmodules
    Stopped at configure line 475.
    

    In the code you can see it tries to open a pipe to a git process, which apparently did open (because it did not die there), but then does not read anything from the file handle

    my $prop_value = <$fd>;
    

    Which then causes the code to die.

      if (!$prop_value) {
        die("Couldn't get $full_prop_name from .gitmodules\nStopped");
      }
    

    What you need to investigate, perhaps, is why the git process did not read anything from the pipe.