Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script command fails, Function not implemented #2053

Closed
brendandburns opened this issue May 3, 2017 · 6 comments
Closed

script command fails, Function not implemented #2053

brendandburns opened this issue May 3, 2017 · 6 comments

Comments

@brendandburns
Copy link

brendandburns commented May 3, 2017

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.15063]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
    script "echo foo"

  • What's wrong / what should be happening instead:

Observed: Crashes with script: cannot set signal handler: Function not implemented
Expected: It should work and not crash.

  • Strace of the failing command, if applicable: (If <cmd> is failing, then run strace -o strace.txt -ff <cmd>, and post the strace.txt output here)

Relevant strace:

... more trace above this ...
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
fstat(1, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "Script started, file is typescri"..., 35) = 35
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 -opost -isig -icanon -echo ...}) = 0
ioctl(0, TCGETS, {B38400 -opost -isig -icanon -echo ...}) = 0
rt_sigprocmask(SIG_BLOCK, [INT QUIT TERM CHLD WINCH], [], 8) = 0
write(2, "script: ", 8)                 = 8
write(2, "cannot set signal handler", 25) = 25
write(2, ": ", 2)                       = 2
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Function not implemented\n", 25) = 25
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

See our contributing instructions for assistance.

@therealkenc
Copy link
Collaborator

It definitely looks like we aren't getting ENOSYS out of strace output these days. All the relevant syscalls look like they succeed above because one is missing. It looks like the relevant line of code in script(1) is here:

	/* block signals used for signalfd() to prevent the signals being
	 * handled according to their default dispositions */
	sigprocmask(SIG_BLOCK, &ctl.sigset, &ctl.sigorg);

	if ((ctl.sigfd = signalfd(-1, &ctl.sigset, SFD_CLOEXEC)) < 0)
		err(EXIT_FAILURE, _("cannot set signal handler"));

signalfd(2) is oldie but a goodie #129. But that strace problem really needs addressing.

@stehufntdev
Copy link
Collaborator

Thanks for reporting the issue, yes I can confirm signalfd is not implemented.

@therealkenc, is there a post on the strace ENOSYS issue? Just started a thread with folks internally and we will take a look.

@therealkenc
Copy link
Collaborator

therealkenc commented May 4, 2017

@stehufntdev - No issue ticket specific to the ENOSYS strace issue, probably because it is nontrivial to recognize. It has shown up in #2013 (message with test case) and previously in #1530.

@CherryDT
Copy link

CherryDT commented Jun 26, 2017

Note that this also, for some reason, messes up the terminal after it failed. I'm on 15063.

When I run script I get the output:

Script started, file is typescript
script: cannot set signal handler: Function not implemented

And afterwards, the terminal doesn't echo stdin anymore (but accept it, e.g. exit will print logout and quit, but the word exit is not visible) and it doesn't handle newlines correctly (Enter will just append another prompt, and Ctrl+C will go to the next line but not reset the column):

image

Strace attached.
script_strace.txt

@superherointj
Copy link

Right now, can't use 'bs-loader' on WSL, main webpack module loader for bucklescript/reason, because of this. Instead of working around upstream everywhere that is using script, would be nice having it fixed instead.

This is breaking everything that relies on 'script'.

@jackchammons @benhillis Is it going to be fixed?

@therealkenc
Copy link
Collaborator

Dupe of #129 to keep unimplemented signalfd in one place. 10 votes on User Voice as of this writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants