News for hackers. Stuff that matters.
Re:Dwarf Fortress starting during apt-get upgrade by pwdisswordfish on Wednesday August 16, 2017 @04:34AM (#15025872)
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

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

Re:Dwarf Fortress starting during apt-get upgrade by phaemon on Wednesday August 16, 2017 @05:21AM (#15026064)
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.

Re:Dwarf Fortress starting during apt-get upgrade by glandium on Wednesday August 16, 2017 @07:15AM (#15026565)
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.
Re:Dwarf Fortress starting during apt-get upgrade by MichaelBurge on Wednesday August 16, 2017 @08:31AM (#15026932)
That has the same problem, just with a different name. So your solution solves a style complaint, not an actual functional problem.
Re:Dwarf Fortress starting during apt-get upgrade by sslayer on Wednesday August 16, 2017 @11:49AM (#15028428)
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)
Re:Dwarf Fortress starting during apt-get upgrade by linsomniac on Wednesday August 16, 2017 @09:36AM (#15027311)
How is the "tail -1" useless? The output of that df command is two lines, one contains the column headers and the next contains the data.
Re:Dwarf Fortress starting during apt-get upgrade by glandium on Wednesday August 16, 2017 @09:37AM (#15027315)
because `... | tail -n -1 | awk '{...}'` is the same as `... | awk 'END {...}'`.
Re:Dwarf Fortress starting during apt-get upgrade by lorenzhs on Wednesday August 16, 2017 @08:39AM (#15026976)
On the node thing: that decision has recently been reversed by the technical committee, effective in the next release (it is in unstable now). See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862051 - nodejs will now simply be 'node'.
Re:Dwarf Fortress starting during apt-get upgrade by orf on Wednesday August 16, 2017 @04:54AM (#15025959)
It could be called from a bash script rather than from within apt itself.
Re:Dwarf Fortress starting during apt-get upgrade by oelmekki on Wednesday August 16, 2017 @06:19AM (#15026331)
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.

Re:Dwarf Fortress starting during apt-get upgrade by pwdisswordfish on Wednesday August 16, 2017 @09:55AM (#15027443)
> this still means user can't use system's `df` easily

    \df
There you go.
Re:Dwarf Fortress starting during apt-get upgrade by oelmekki on Wednesday August 16, 2017 @10:01AM (#15027493)
Awesome, didn't know about that. Thanks!
Re:Dwarf Fortress starting during apt-get upgrade by AndrewOMartin on Wednesday August 16, 2017 @09:31AM (#15027264)
They could still type /bin/df, and they could also use:

alias freespace=/bin/df

Though then they'd have to uninstall FreeSpace 2.

Re:Dwarf Fortress starting during apt-get upgrade by cpach on Wednesday August 16, 2017 @09:19AM (#15027188)
Why not name the alias something else than “df”? :) dfortress or something like that. Then it won’t collide with df(1).
Re:Dwarf Fortress starting during apt-get upgrade by oelmekki on Wednesday August 16, 2017 @09:26AM (#15027222)
This is by far the best approach, yes :)

My point was more to show a way this particular user could have achieved the same result without their problem.

Plus, we can't expect users to know all the system tools, this is a good way to isolate "user space" from "system space", so I guess taking the habit to use aliases rather than putting things in `/usr/local/bin/` makes sense by itself (except when we want indeed to override an executable provided by system, or we want indeed to provide a new system tool).

Re:Dwarf Fortress starting during apt-get upgrade by grabcocque on Wednesday August 16, 2017 @04:18AM (#15025798)
The fact that the dwarf fortress binary is just 'df' was asking for trouble. In hindsight seems amazing nobody reported this before.
Re:Dwarf Fortress starting during apt-get upgrade by pawadu on Wednesday August 16, 2017 @04:30AM (#15025852)
That's how i feel about "convert" from imagemagick
Re:Dwarf Fortress starting during apt-get upgrade by sohkamyung on Wednesday August 16, 2017 @05:33AM (#15026121)
Which is why I use graphicsmagick [1] instead. The imagamagick executables becomes options behind the 'gm' executable.

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

Re:Dwarf Fortress starting during apt-get upgrade by igravious on Wednesday August 16, 2017 @05:40AM (#15026160)
Can't believe I never heard of GraphicsMagick. Thanks for the heads up. I wonder if it has a Ruby interface.
Re:Dwarf Fortress starting during apt-get upgrade by patio11 on Wednesday August 16, 2017 @08:28AM (#15026908)
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.)

Re:Dwarf Fortress starting during apt-get upgrade by tome on Wednesday August 16, 2017 @04:49AM (#15025931)
And "import"!
Re:Dwarf Fortress starting during apt-get upgrade by scbrg on Wednesday August 16, 2017 @06:37AM (#15026403)
Hate it when I'm starting a newly written python script, and have forgotten the hashbang. For some reason my mouse cursor turns into a cross, and the script does nothing!

Always takes me a couple of seconds to realize what's going on...

Re:Dwarf Fortress starting during apt-get upgrade by masklinn on Wednesday August 16, 2017 @07:49AM (#15026711)
I have a similar issue where I tend to start typing python code in the shell without remembering to enter the repl first.
Re:Dwarf Fortress starting during apt-get upgrade by DrJokepu on Wednesday August 16, 2017 @08:35AM (#15026957)
PostgreSQL's "initdb"!
Re:Dwarf Fortress starting during apt-get upgrade by asdfaoeu on Wednesday August 16, 2017 @08:45AM (#15027004)
That's still much better than their 'createuser'
Re:Dwarf Fortress starting during apt-get upgrade by 0xfeba on Wednesday August 16, 2017 @09:00AM (#15027076)
`testparm` for Samba.
Re:Dwarf Fortress starting during apt-get upgrade by empath75 on Wednesday August 16, 2017 @08:22AM (#15026873)
packer has a name collision, too.
Re:Dwarf Fortress starting during apt-get upgrade by concede_pluto on Wednesday August 16, 2017 @02:59PM (#15030146)
http://pubs.opengroup.org/onlinepubs/009696799/utilities/df.... says what df does on any POSIX system. I love Dwarf Fortress but running it as root is more !!fun!! than I'm looking for.
Re:Dwarf Fortress starting during apt-get upgrade by giancarlostoro on Wednesday August 16, 2017 @01:17AM (#15025113)
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 :)

Re:Dwarf Fortress starting during apt-get upgrade by pawadu on Wednesday August 16, 2017 @04:25AM (#15025826)
wasnt getc() available on windows?
Re:Dwarf Fortress starting during apt-get upgrade by Const-me on Wednesday August 16, 2017 @05:52AM (#15026217)
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.

Re:Dwarf Fortress starting during apt-get upgrade by c0nfused on Wednesday August 16, 2017 @03:31PM (#15030438)
sl also starts for LS too in case you have capslock on.
Re:Dwarf Fortress starting during apt-get upgrade by proactivesvcs on Wednesday August 16, 2017 @06:15AM (#15026316)
Why not have some Fun while waiting for upgrades to install? The bug is that apt doesn't carry on in the background ;-)
Re:Dwarf Fortress starting during apt-get upgrade by ChuckMcM on Wednesday August 16, 2017 @02:00AM (#15025257)
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.
Re:Dwarf Fortress starting during apt-get upgrade by exikyut on Wednesday August 16, 2017 @07:03AM (#15026511)
What was the other one?
Re:Dwarf Fortress starting during apt-get upgrade by Triave on Wednesday August 16, 2017 @07:58AM (#15026753)
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...

Re:Dwarf Fortress starting during apt-get upgrade by jwilk on Wednesday August 16, 2017 @09:06AM (#15027115)
Re:Dwarf Fortress starting during apt-get upgrade by vbezhenar on Wednesday August 16, 2017 @04:32AM (#15025860)
Don't trust $PATH in scripts. Use `/bin/df`.
Re:Dwarf Fortress starting during apt-get upgrade by iso-8859-1 on Wednesday August 16, 2017 @06:03AM (#15026256)
But then it's not portable across distros and to BSD's. On FreeBSD, bash is in /usr/local/bin/bash (if it is installed)

Do you also write "if /usr/bin/[ $? != 0 ]; then ..." ?

Re:Dwarf Fortress starting during apt-get upgrade by lottin on Wednesday August 16, 2017 @06:37AM (#15026405)
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.
Re:Dwarf Fortress starting during apt-get upgrade by JdeBP on Wednesday August 16, 2017 @07:51AM (#15026725)
Re:Dwarf Fortress starting during apt-get upgrade by mnw21cam on Wednesday August 16, 2017 @06:58AM (#15026492)
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?
Re:Dwarf Fortress starting during apt-get upgrade by oelmekki on Wednesday August 16, 2017 @07:17AM (#15026573)
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.

Re:Dwarf Fortress starting during apt-get upgrade by rmc on Wednesday August 16, 2017 @08:51AM (#15027039)
Actually cd is a shell built in, not a separate binary
Re:Dwarf Fortress starting during apt-get upgrade by shmerl on Wednesday August 16, 2017 @12:58AM (#15025039)
I didn't know Dwarf Fortress was packaged in Debian. The last time I tried playing it on Linux, it was annoyingly 32-bit.
Re:Dwarf Fortress starting during apt-get upgrade by tome on Wednesday August 16, 2017 @04:52AM (#15025940)
The SO question doesn't imply that it is, just that it's installed on the user's machine.
Re:Dwarf Fortress starting during apt-get upgrade by pawadu on Wednesday August 16, 2017 @04:27AM (#15025839)
> 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...

Re:Dwarf Fortress starting during apt-get upgrade by mikekchar on Wednesday August 16, 2017 @08:46AM (#15027009)
The text renderer seems to use considerably less CPU that the graphics one. I've been tempted to set up a docker image...
Re:Dwarf Fortress starting during apt-get upgrade by mnw21cam on Wednesday August 16, 2017 @05:30AM (#15026105)
Yeah, there's a 64-bit version now.
Re:Dwarf Fortress starting during apt-get upgrade by jwilk on Wednesday August 16, 2017 @09:17AM (#15027183)
It's not packaged.
Re:Dwarf Fortress starting during apt-get upgrade by readams on Wednesday August 16, 2017 @01:22AM (#15025129)
Some programs are 32-bit, but not to such an annoying extent.
Re:Dwarf Fortress starting during apt-get upgrade by Ao7bei3s on Wednesday August 16, 2017 @02:16AM (#15025313)
It's mostly about all necessary libraries being available for the same architecture as the binary.

This means either having separate 32bit libraries (typical for closed source applications shipping together with their libraries) or having multiarch libraries (as modern linux distros do).

Re:Dwarf Fortress starting during apt-get upgrade by djvdorp on Wednesday August 16, 2017 @02:41AM (#15025403)
I just spilled my coffee