Skip to content

Remove temporary file on termination signal #81

Open
@magicant

Description

@magicant

Describe the bug

POSIX XCU 1.4 requires in the "Output files" sub-section:

Any temporary file created by the implementation shall be removed by the implementation upon a utility's successful exit, exit because of errors, or before termination by any of the SIGHUP, SIGINT, or SIGTERM signals, unless specified otherwise by the utility description.

Currently, temporary files are not removed if the shell is killed by a signal.

To Reproduce

Steps to reproduce the behavior:

  1. Enable the vi line-editing mode.
  2. On the command line, press Escape to switch to the normal mode and then press v to invoke the command editor.
  3. Send SIGHUP to the shell waiting for the editor to finish.
  4. The signal kills the shell, but the temporary file remains.

Expected behavior

The shell must remove the temporary file then terminate by resending the same signal to itself.
This is the behavior required by POSIX. (See also the "Asynchronous events" sub-section in POSIX XCU 1.4.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions