1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Unreachable code in makeBaseApp.pl? |
From: | Stephen Molloy <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Thu, 7 Jul 2016 14:45:48 +0000 |
Hi all,
While building Docker containers, I had an error that turned out to be due to the lack of a $USER environment variable. When makeBaseApp.pl is called, it tries to figure out the username in the GetUser subroutine, using the following command:
$user = $opt_u || $ENV{USER} || $ENV{USERNAME} || Win32::LoginName(); This command is problematic on Linux machines since it will fail if a username is not supplied via the –u flag and $USER and $USERNAME are not set. This means that the remainder of that subroutine (where the user is queried for their name), will not be
executed.
It seems to me that the Win32::LoginName() call should only be attempted if the host architecture is verified to be a Windows machine, or perhaps it could be wrapped in a try/catch in order to prevent the non-existence of Win32::LoginName from crashing
the code.
Of course, it’s very possible that this issue is caused by something that I am doing wrong….
Thanks,
Steve
|