PartialVolume 4241485e6a Fix segfault on Control-C, after a successful wipe
Symptoms: If you control-C to exit nwipe at the end of a successful
wipe you would get a segmentation fault. If nwipe log data was being
sent to stdout rather than to a log file, then you would not see the
log in the terminal windows after nwipe had exited. This patch fixes
those problems by creating a tri-state wipe flag for each wipe
thread. The main thread after having launched the wipe threads
will wait for ALL wipe flags to report that the wipe routine has
completed and the thread has exited. Only at that time does the
main() routine then proceed with joining the threads and waiting
for the join to confirm the thread has indeed exited. This join
is important as the thread will not actually exit until the OS
has flushed the disk buffers. Currently nwipe does not use O_SYNC
where data is sent straight to disk. Therefore it's important
to wait for data to be flushed before exiting nwipe. Part of this
patch is introducing a "please wait .. disks are being flushed"
prior to exiting nwipe otherwise it might look like nwipe had
hung. A disk flush in terms of how long it takes, can be from
instantly to 30 seconds or more, depending on how much system
memory you have, when the last sync occurred and if you have
changed the sync option from it's default. Something else to
note is that when all wipes have finished nwipe displays "Enter
To Exit" on the status line at the bottom of the screen. I
believe typing 'enter' rather than control-c did not produce a
segmentation fault. Irrespective, both methods of exiting nwipe
have been tested and confirmed to now work correctly. Tested
overnight with two drives using multiple wipe methods,
verification and blanking.
2019-11-14 01:07:08 +00:00
2017-12-02 20:18:53 +01:00
2019-11-09 10:39:22 -05:00
2019-11-02 19:24:25 -04:00
2017-02-21 22:31:11 +01:00
2017-02-21 22:31:11 +01:00
2017-02-21 22:31:11 +01:00

nwipe

nwipe is a command that will securely erase disks using a variety of recognised methods. It is a fork of the dwipe command used by Darik's Boot and Nuke (dban). nwipe is included with partedmagic if you want a quick and easy bootable CD version. nwipe was created out of a need to run the DBAN dwipe command outside of DBAN, in order to allow its use with any host distribution, thus giving better hardware support.

Compiling & Installing

nwipe requires the following libraries to be installed:

  • ncurses
  • pthreads
  • parted

Debian & Ubuntu prerequisites

If you are compiling nwipe from source, the following libraries will need to be installed first:

sudo apt install \
  build-essential \
  pkg-config \
  automake \
  libncurses5-dev \
  autotools-dev \
  libparted-dev \
  dmidecode

Fedora prerequisites

sudo bash
dnf update
dnf groupinstall "Development Tools"
dnf groupinstall "C Development Tools and Libraries"
yum install ncurses-devel
yum install parted-devel
yum install dmidecode

Note. dmidecode is optional, it provides SMBIOS/DMI host data to stdout or the log file.

Compilation

For a development setup, see the hacking section below.

First create all the autoconf files:

./init.sh

Then compile & install using the following standard commands:

./configure
make
make install

Hacking

If you wish to submit pull requests to this code we would prefer you enable all warnings when compiling. This can be done using the following compile commands:

./configure --prefix=/usr CFLAGS='-O0 -g -Wall -Wextra'
make
make install

The -O0 -g flags disable optimisations. This is required if you're debugging with gdb in an IDE such as Kdevelop. With these optimisations enabled you won't be able to see the values of many variables in nwipe, not to mention the IDE won't step through the code properly.

The -Wall and -Wextra flags enable all compiler warnings. Please submit code with zero warnings.

Once done with your coding then the released/patch/fixed code can be compiled, with all the normal optimisations, using:

./configure --prefix=/usr && make && make install

Bugs

Bugs can be reported on GitHub: https://github.com/martijnvanbrummelen/nwipe

License

GNU General Public License v2.0

Description
No description provided
Readme 12 MiB
Languages
C 98.8%
C++ 1%
M4 0.1%