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

stdin issue with lvdisplay command #9128

Closed
blackduckx opened this issue Dec 9, 2013 · 3 comments
Closed

stdin issue with lvdisplay command #9128

blackduckx opened this issue Dec 9, 2013 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior

Comments

@blackduckx
Copy link
Contributor

Hi,

I am currently using the lvm module in a few states files throught the use of lvm.lv_present.

I noticed the following behavior on my states:
-> when launched localy, through salt-call, the lvdisplay command is working fine
-> when launched remotely it fails

To dig a bit further, I ran the following test case around the lvdisplay command
and I found a workaround. Set the stdin to /dev/null

QUESTION: I am currently wondering the right way to fix that bug. Be specific on the lvm module or set it directly in the cmdmod module ... This may need further investigation ? Your thought ? Is there a global file descriptor issue ?

KO Test case :

[brin_f@xxxx ]$ sudo salt 'remote' cmd.run 'lvdisplay -c /dev/vg_sys/lv_ullink'
sdl-ullnk-101:
      stdin: fdopen failed: Invalid argument
      stdin: fclose failed: Invalid argument
      stdin: fdopen failed: Invalid argument

OK test case:

[brin_f@xxxxx]$ sudo salt 'remote' cmd.run 'lvdisplay -c /dev/vg_sys/lv_ullink' stdin=/dev/null
remote:
      '/dev/vg_sys/lv_ullink:vg_sys:3:1:-1:1:125829120:1920:-1:0:-1:253:5'

Regards,
Frédéric

@basepi
Copy link
Contributor

basepi commented Dec 9, 2013

Thanks for the report. This may not be an actual bug in salt, but rather just an idiosyncrasy in the way salt and lvdisplay interact. But we'll investigate.

@blackduckx
Copy link
Contributor Author

Hi all,

Tracking it looks like the issue comes from the difference between the file status flags of the console fds.
See after.

The Good

fcntl(0, F_GETFD)                       = 0
dup(0)                                  = 3
close(0)                                = 0
dup2(3, 0)                              = 0
close(3)                                = 0
fcntl(0, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13a6012000
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
munmap(0x7f13a6012000, 4096)            = 0
fcntl(1, F_GETFD)                       = 0
dup(1)                                  = 3
close(1)                                = 0
dup2(3, 1)                              = 1
close(3)                                = 0
fcntl(1, F_GETFL)                       = 0x1 (flags O_WRONLY)
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13a6012000
lseek(1, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
munmap(0x7f13a6012000, 4096)            = 0

The Bad

fcntl(0, F_GETFD)                       = 0
dup(0)                                  = 3
close(0)                                = 0
dup2(3, 0)                              = 0
close(3)                                = 0
fcntl(0, F_GETFL)                       = 0x8401 (flags O_WRONLY|O_APPEND|O_LARGEFILE)
write(2, "  ", 2)                       = 2
write(2, "stdin: fdopen failed: Invalid ar"..., 38) = 38
write(2, "\n", 1)                       = 1
fcntl(0, F_GETFD)                       = 0
dup(0)                                  = 3
write(2, "  ", 2)                       = 2
write(2, "stdin: fclose failed: Invalid ar"..., 38) = 38
write(2, "\n", 1)                       = 1
dup2(3, 0)                              = 0
close(3)                                = 0
fcntl(0, F_GETFL)                       = 0x8401 (flags O_WRONLY|O_APPEND|O_LARGEFILE)
write(2, "  ", 2)                       = 2
write(2, "stdin: fdopen failed: Invalid ar"..., 38) = 38
write(2, "\n", 1)                       = 1
fcntl(1, F_GETFD)                       = 0
dup(1)                                  = 3
close(1)                                = 0
dup2(3, 1)                              = 1
close(3)                                = 0
fcntl(1, F_GETFL)                       = 0x1 (flags O_WRONLY)
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa788934000
lseek(1, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
exit_group(-1)                          = ?

Stdout Error

stdin: fdopen failed: Invalid argument
stdin: fclose failed: Invalid argument
stdin: fdopen failed: Invalid argument

s0undt3ch added a commit that referenced this issue Dec 13, 2013
Fix for bug #9128: issue with salt-master ttys with lvdisplay command
@s0undt3ch
Copy link
Collaborator

Fixed in #9227

basepi added a commit that referenced this issue Dec 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior
Projects
None yet
Development

No branches or pull requests

3 participants