All of lore.kernel.org
 help / color / mirror / Atom feed
* chcat is using getlogin() function that sometimes returns null/empty string
@ 2015-12-07 18:01 Laurent Bigonville
  2015-12-07 19:57 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Bigonville @ 2015-12-07 18:01 UTC (permalink / raw)
  To: selinux

Hi,

So apparently gnome-terminal developers have decided to stop updating 
utmp[0] file and this is breaking chcat -Ll with the following error:

Traceback (most recent call last):
   File "/usr/bin/chcat", line 409, in <module>
     sys.exit(listusercats(cmds))
   File "/usr/bin/chcat", line 352, in listusercats
     users.append(os.getlogin())
OSError: [Errno 2] No such file or directory

getlogin(3) manpage suggest to rely on the LOGNAME environment variable, 
so maybe chcat should fallback to this if getlogin() is not returning 
anything?

Cheers,

Laurent Bigonville

[0] https://bugzilla.gnome.org/show_bug.cgi?id=747046

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: chcat is using getlogin() function that sometimes returns null/empty string
  2015-12-07 18:01 chcat is using getlogin() function that sometimes returns null/empty string Laurent Bigonville
@ 2015-12-07 19:57 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2015-12-07 19:57 UTC (permalink / raw)
  To: Laurent Bigonville, selinux

On 12/07/2015 01:01 PM, Laurent Bigonville wrote:
> Hi,
>
> So apparently gnome-terminal developers have decided to stop updating
> utmp[0] file and this is breaking chcat -Ll with the following error:
>
> Traceback (most recent call last):
>    File "/usr/bin/chcat", line 409, in <module>
>      sys.exit(listusercats(cmds))
>    File "/usr/bin/chcat", line 352, in listusercats
>      users.append(os.getlogin())
> OSError: [Errno 2] No such file or directory
>
> getlogin(3) manpage suggest to rely on the LOGNAME environment variable,
> so maybe chcat should fallback to this if getlogin() is not returning
> anything?
>
> Cheers,
>
> Laurent Bigonville
>
> [0] https://bugzilla.gnome.org/show_bug.cgi?id=747046

Maybe just use:
pwd.getpwuid(os.getuid()).pw_name

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 18:01 chcat is using getlogin() function that sometimes returns null/empty string Laurent Bigonville
2015-12-07 19:57 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.