Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

slam command don't slam #77

Closed
davinerd opened this Issue · 21 comments

3 participants

@davinerd
Collaborator

slam_tomb() should be revised: it don't slam tomb.
I'm unsure about fuser syntax; also, we don't implement an -f option, but the code above mentions it.

Anyone got this issue? Please check it out.

@boyska
Collaborator

Works for me. But you're right, the "-f" option is not recognized by slam subcommand, we should add it.
I tried with vim being the bad process, and it exited on USR1.
then I tried with dd, which does NOT exit on USR1 (instead, it displays stats), and it exited on HUP (after 3 seconds)

@davinerd
Collaborator
@boyska
Collaborator

again, works for me.
```davide ~/Desktop % tomb open testing.tomb
Password: [] Commanded to open tomb testing.tomb
. mountpoint not specified, using default: /media/testing.tomb
[
] mounting testing.tomb on mountpoint /media/testing.tomb
. check for a valid LUKS encrypted device
[] Password is required for key testing
. encrypted storage filesystem check
fsck da util-linux 2.20.1
testing: clean, 13/4608 files, 1768/18432 blocks
[
] encrypted storage testing.tomb succesfully mounted on /media/testing.tomb
davide ~/Desktop % tomb slam
[] Slamming tomb testing mounted on /media/testing.tomb
. Kill all processes busy inside the tomb
[
] Tomb testing closed: your bones will rest in peace.
davide ~/Desktop % tomb list
[!] I can't see any open tomb, may they all rest in peace.

@davinerd
Collaborator
@boyska
Collaborator

You seem to be right. Indeed, fuser -s -m $1 always returns 0. BUT fuser -m $1 &> /dev/null has the behaviour we need.
Try if this change make it work fine.

@jaromil
Owner

nope, it still returns 0

I've done some tries, but fuser seems to me a non-well formed commandline command.

why we changed to it? not for reliability, just for it being elegant?

I vote for reliability and revert to lsof parsing unless someone comes with a reliable use of fuser. I couldn't.

@davinerd davinerd was assigned
@jaromil
Owner

just for reference, incriminated commit:
d53c028

@davinerd
Collaborator
@jaromil
Owner

no the -f flag is not needed. actually I'm wondering now if we need the 'slam' command at all. we can start activating slam also when 'close -f' is called.

@davinerd
Collaborator
@boyska
Collaborator

mh, there is a problem. Atm, slam use the -f flag to control whether or not to sleep between the kills.
We need to find another name, for this, like:
tomb close #normal
tomb close -f # same as tomb slam
tomb close -f --brutal # same as tomb slam -f

@davinerd
Collaborator
@jaromil
Owner

mmm, wait a sec. we need to have LESS flags, not more. they complicate things, give users more documentation to read and often introduce ambiguity. I personally dream of a world without flags! (voluntary double-sense)

said that, there is no problem because:

close -f -> slam (wait)
slam -f -> slam (nowait)

@davinerd
Collaborator
@boyska
Collaborator

davinerd,jaromil: is fuser -m $1 &> /dev/null a valid solution for the problem? shall we commit it? please test it

@jaromil
Owner

I've tested it again and same result: it does return zero all the time (I've tested on common Ubuntu and Debian systems)

We need something else there to return non-zero if the directory is not being used....

@boyska
Collaborator

uff.
we could do something like fuser|wc -w (that checks if there is any result), and checking it being zero/non-zero.
It do what expected, here, and it should work flawlessy everywhere. Can you test it, please? I want to get rid of this issue quickly.

@jaromil
Owner

yes we need to solve this issue quick.

on the return code I get a different behaviour on debian and ubuntu (!?)

instead, your approach seems to work. i'm trying only on debian now
assuming '/' is in use and '/mnt' is not in use on my comp now, I tried

% caz=fuser /mnt 2> /dev/null ; { test "$caz" = "" } && { echo vuoto }
vuoto
% caz=fuser / 2> /dev/null ; { test "$caz" = "" } && { echo vuoto }
(return 1)

seems to be viable

@boyska
Collaborator

your simplification is fine: so the code is

if [[ -n `fuser -m /mount/point 2> /dev/null` ]]; then #there are processes
@boyska boyska referenced this issue from a commit
@boyska boyska FIX (tries) #77: slam wasn't slamming
That's because fuser behaves differently on debian.
(Why, debian, why???)
d57994f
@boyska
Collaborator

I tried to fix it with this new commit. Hope it works, please everyone test it.

tomb-git package for archlinux has been updated. arch testers, no excuses for you :)

@jaromil
Owner

It works for me, I've been using it for a year now. Thanks :^)

@jaromil jaromil closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.