chroot_directory conflicts with stdin/out/err options

Bug #662682 reported by Bud P. Bruegger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-daemon (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: python-daemon

When combining chrooting with redirection of stdin/out/err to a file, an exception occurs.

The cause is that in DaemonContext.open, "change_root_directory" is called at line 320 before "redirect_stream" is called at line 719. Redirect_stream uses os.devnull. It seems that a chrooting makes /dev/null invisible when redirect_stream is called.

Among the two possible solutions I see is to call chroot after redirect_stream (but note, the test verifies the sequence, so this may not be a good solution), or to have an instance variable reference os.devnull before chrooting and make sure the file (/dev/null) is added to exclude_fds (called at line 336) such that it will not be closed in close_all_open_files at line 337

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.