
Dwarf Fortress starting during apt-get upgrade - rayalez
https://askubuntu.com/questions/938606/dwarf-fortress-starting-during-apt-get-upgrade
======
pwdisswordfish
The real WTF is that APT spawns an external process to check disk usage,
instead of invoking statvfs() on its own.

Some cases are less clear-cut, however. For example, the Debian 'nodejs'
package installs node.js binary as /usr/bin/nodejs and not /usr/bin/node
because it conflicts with another package: [https://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=614907#108](https://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=614907#108)

And let's not forget rename(1) from util-linux versus the Perl rename(1)...

~~~
phaemon
It isn't `apt`. See how they mentioned that `mysql` packages were installing?
Well, in the `preinst` shell script, in the .deb, there is the line:

`if LC_ALL=C BLOCKSIZE= df --portability $DATADIR/. | tail -n 1 | awk '{ exit
($4>1000) }'; then`

There's `df` being called without the full path and that's what would be
spawning Dwarf Fortress.

~~~
glandium
That doesn't make it much better though. Parsing the output of df (with a
useless tail -1) is kind of awful when you can use something like stat -f -c
%a.

~~~
MichaelBurge
That has the same problem, just with a different name. So your solution solves
a style complaint, not an actual functional problem.

~~~
sslayer
I agree with your comment about it being functional. But wouldn't removing
tail from the pipe remove complexity and speed up the processing(Arguably,
most likely only by a small fraction)

------
oelmekki
Using aliases in `~/.bashrc` rather than putting scripts or symlinks in $PATH
is a good mean to avoid those kind of problems, provided bashrc includes code
to quit if ran in non-interactive mode (default at least on ubuntu).

Many use aliases only to specify default command parameters, but it works just
as well to provide an execution path, like, in this case:

    
    
        alias df=/home/my_user/games/dwarf_fortress/df
    

It would only be executed in interactive sessions, this way, which should
guard well enough against system code interpreting it.

Of course, this still means user can't use system's `df` easily, but I guess
they don't use it anyway since they did not realize the problem until that
upgrade.

~~~
pwdisswordfish
> this still means user can't use system's `df` easily
    
    
        \df
    

There you go.

~~~
oelmekki
Awesome, didn't know about that. Thanks!

------
grabcocque
The fact that the dwarf fortress binary is just 'df' was asking for trouble.
In hindsight seems amazing nobody reported this before.

~~~
pawadu
That's how i feel about "convert" from imagemagick

~~~
sohkamyung
Which is why I use graphicsmagick [1] instead. The imagamagick executables
becomes options behind the 'gm' executable.

[1] [http://www.graphicsmagick.org/](http://www.graphicsmagick.org/)

~~~
igravious
Can't believe I never heard of GraphicsMagick. Thanks for the heads up. I
wonder if it has a Ruby interface.

~~~
patio11
IIRC yes but, since it leaked memory like a sieve, I did everything via
_system( "gm ...")_

(This memory is a few years out of date.)

------
giancarlostoro
When I did my first few programming courses we were using C and on Windows,
and using system("pause"); was our way of keeping cmd from closing. So as a
joke over the years I've made a pause script for Linux in Python, Perl and
even bash just so I can make such code valid.

But putting a whole game in place of a standard Linux util sounds like awesome
menace, reminds me of the sl command (steam locomotive) which you can install
on Debian (and maybe other distros?) for those who may typo ls they'll get a
fun surprise :)

~~~
pawadu
wasnt getc() available on windows?

~~~
Const-me
It was and still is, the name is _getch() from <conio.h>

However, I can see how for a beginner programmer system("pause"); is more
intuitive than printf/_getch() combo. Especially if said programmer is already
familiar with windows shell and its commands.

------
proactivesvcs
Why not have some Fun while waiting for upgrades to install? The bug is that
apt doesn't carry on in the background ;-)

------
ChuckMcM
Just wait till they release "Ground Control Center" (gcc) :-) For a long time
there were two things called 'git' and installing the 'wrong' one invariably
led to similar hijinks.

~~~
exikyut
What was the other one?

~~~
Triave
I'm guessing the interactive fiction interpreter [1], which predated the
version control system by a couple of years.

[1]
[http://web.archive.org/web/20120826174233/http://diden.net/i...](http://web.archive.org/web/20120826174233/http://diden.net/if/git/)

------
jwilk
[https://bugs.debian.org/752114](https://bugs.debian.org/752114)

------
vbezhenar
Don't trust $PATH in scripts. Use `/bin/df`.

~~~
lottin
df is a standard utility, like ls or cd. Invoking df on a POSIX system should
do the expected thing, and if it doesn't it means something is broken.

~~~
mnw21cam
On Unix/Linux, there is very little stopping the superuser from introducing
new and inventive kinds of breakage, such as in this case. This one is just a
little more amusing than most. But seriously, if root wants to install a new
command called df and have it higher up in the PATH than the standard utility,
why should the OS argue?

~~~
oelmekki
Note that the OS doesn't argue :)

But actually, it would be cool to have some kind of warning, like a POSIX
linter that warns the user something broke the standard, and they can decide
to ignore it and never hear about it again. I'm not a big fan of linters,
usually, but it would make sense for end users tweaking their system.

------
shmerl
I didn't know Dwarf Fortress was packaged in Debian. The last time I tried
playing it on Linux, it was annoyingly 32-bit.

~~~
pawadu
> I didn't know Dwarf Fortress was packaged in Debian

well, goodbye productivity.

I wonder if I can run it on a production server without anyone noticing...

~~~
mikekchar
The text renderer seems to use considerably less CPU that the graphics one.
I've been tempted to set up a docker image...

------
djvdorp
I just spilled my coffee

