libmesh icon indicating copy to clipboard operation
libmesh copied to clipboard

'make install' asks interactive questions

Open yurivict opened this issue 4 years ago • 8 comments

rev. 746b489 asks this question:

mv /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config.installed /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config && chmod +x /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config
override r-xr-xr-x  yuri/wheel for /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config? (y/n [n]) 

yurivict avatar Oct 06 '20 16:10 yurivict

I'll let @roystgnr comment, but this looks like a part of the install-data-hook target which is in TIMPI's Makefile.am. I assume the interactive question is coming from chmod, so I'm not sure what the best platform-independent fix is as I've never seen it ask this on Mac or Linux and there does not appear to be a -f flag for chmod.

jwpeterson avatar Oct 06 '20 18:10 jwpeterson

I can see someone else getting the same confirmation request (though just as our command here mixes chmod with a mv, their report is for a shell script so who knows what command triggered that message) on Mac Catalina 10.15.

And at that point I'm baffled. POSIX specifies an interactive mode for mv, but we don't use it, and I see nothing suggesting any interactivity for chmod.

But regardless of what's causing the problem, perhaps we could avoid the problem in most cases by getting rid of the sed+mv and moving that chmod inside the if block? The sed+mv immediately preceding chmod appears to be an atavism, since our config scripts don't use the has_been_installed variable now, and the earlier sed command is only necessary when someone's supplying a new prefix on the fly to "make install".

roystgnr avatar Oct 06 '20 19:10 roystgnr

The command:

mv /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config.installed /usr/ports/math/libmesh/work/stage/usr/local/bin/timpi-config

asks this interactive question.

It is the continued use of very outdated GNU tools that causes problems like this. There are a lot of custom shell commands that one has to write following GNU tools framework requirements, and some of them don't always behave as expected. Please consider switching to cmake.

yurivict avatar Oct 07 '20 04:10 yurivict

POSIX only allows mv to ask interactive questions if

the -f option is not specified, and either of the following conditions is true:

a. The permissions of the destination path do not permit writing and the standard input is a terminal.

b. The -i option is specified.

Do you have an alias or wrapper or something for mv which does the latter? I presume the former can't be the case if the previous sed command succeeded in writing a file in the same directory.

It is the continued use of very outdated GNU tools that causes problems like this.

There's a "New issue" button here, but not a "New flame war" button, for a reason.

roystgnr avatar Oct 07 '20 18:10 roystgnr

mv needs to have the -f flag.

yurivict avatar Oct 07 '20 18:10 yurivict

Well, that depends on your "mv". I've got the usual paranoid alias, but it only affects interactive commands:

$ type mv
mv is aliased to `\mv -i'
$ touch test1 test2 && mv test1 test2 && ls test*
mv: overwrite 'test2'? n
test1  test2
$ touch test1 test2 && \mv test1 test2 && ls test*
test2
$ sh -c "touch test1 test2 && mv test1 test2 && ls test*"
test2

I agree that "mv -f" is definitely the robust+quick workaround here, and I'll set up PRs. I'm just hoping to understand the problem too, to see how prevalent it might be and to preempt running into it again if we're making any similar mistakes elsewhere.

roystgnr avatar Oct 07 '20 18:10 roystgnr

Please just provide a revision that I can test.

yurivict avatar Oct 07 '20 19:10 yurivict

Might be some delay on that, sorry. This same idiom is in two submodules, one non-optional, along with the main project, and both submodules have had other changes that will hit more testing before we can merge updates to them.

roystgnr avatar Oct 07 '20 19:10 roystgnr