Skip to content
Snippets Groups Projects
Forked from APT Developers / apt
Source project has a limited visibility.
  • Zhang Boyang's avatar
    ec278531
    Fix incorrect SIGWINCH handling · ec278531
    Zhang Boyang authored
    Previously, status line is redrawn in signal handler. However, the
    drawing code make heavy use of std::string and other syscalls, which may
    not be async-signal-safe. This will cause deadlock, overwritten errno,
    even silent memory corruption.
    
    This patch implemented Anders Kaseorg's idea. The signal handler will
    only set a flag, which is async-signal-safe, and actual redrawing will
    be deferred to PackageManagerFancy::Pulse().
    
    Note that the virtual function PackageManagerFancy::Pulse() already
    exists in base class but newly overridden in PackageManagerFancy, so the
    ABI compatibility should be OK. However, existing compiled programs may
    not aware of this new function and continue to use old Pulse() if
    compiler had done heavy optimization. Fortunately this is not too
    harmful because this will only cause status line not redrawing, which
    may consider acceptable.
    
    Closes: #852757
    ec278531
    History
    Fix incorrect SIGWINCH handling
    Zhang Boyang authored
    Previously, status line is redrawn in signal handler. However, the
    drawing code make heavy use of std::string and other syscalls, which may
    not be async-signal-safe. This will cause deadlock, overwritten errno,
    even silent memory corruption.
    
    This patch implemented Anders Kaseorg's idea. The signal handler will
    only set a flag, which is async-signal-safe, and actual redrawing will
    be deferred to PackageManagerFancy::Pulse().
    
    Note that the virtual function PackageManagerFancy::Pulse() already
    exists in base class but newly overridden in PackageManagerFancy, so the
    ABI compatibility should be OK. However, existing compiled programs may
    not aware of this new function and continue to use old Pulse() if
    compiler had done heavy optimization. Fortunately this is not too
    harmful because this will only cause status line not redrawing, which
    may consider acceptable.
    
    Closes: #852757