Pseudo links to binaries do not work at all

Eliot Moss moss@cs.umass.edu
Tue Jun 10 12:18:23 GMT 2025


On 6/10/2025 5:49 AM, Michael Wachs via Cygwin wrote:
> Hello,
>> I'm using a PC with Win11 and since few weeks the latest cygwin64 version.
>> I've found that all pseudo links to binary files, which contain text aka "!<symlink>{command}" do not work at all!
> Neither interactive
>     for example:
>         /usr/bin/view
>                 /usr/bin:[527]$ view
>                 -bash: /usr/bin/view: cannot execute binary file: Exec format error
>> nor in scripts or calling them from own code!
>> I remove such files and replace them by real links with command "ln -fs ...", after that they work correctly!

I can say that files that start this way work:
#!/usr/bin/perl
Note the # (not in your example). In my case, /usr/bin/perl is not a symlink but
a path to an executable. I have verified that symlinks also work. One is allowed
to put ONE option/argument after the path to the executable.
Details from the man page for execve:
 Interpreter scripts
 An interpreter script is a text file that has execute permission enabled and whose first line is of the form:
 #!interpreter [optional-arg]
 The interpreter must be a valid pathname for an executable file.
 If the pathname argument of execve() specifies an interpreter script, then interpreter will be invoked with the 
following arguments:
 interpreter [optional-arg] pathname arg...
 where pathname is the absolute pathname of the file specified as the first argument of execve(), and arg... is 
the series of words pointed to by the argv argument of execve(), starting at argv[1]. Note that there is no way to get 
the argv[0] that was passed to the execve()
 call.
 For portable use, optional-arg should either be absent, or be specified as a single word (i.e., it should not 
contain white space); see NOTES below.
 Since Linux 2.6.28, the kernel permits the interpreter of a script to itself be a script. This permission is 
recursive, up to a limit of four recursions, so that the interpreter may be a script which is interpreted by a script, 
and so on.
HTH - Eliot Moss


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /