Skip to content

Conversation

@bebehei
Copy link
Member

@bebehei bebehei commented Dec 21, 2017

Setting PREFIX to a location different to /usr, the install routine
fails to install the systemd and dbus service files. These are
installed, but in the PREFIX directory and not /usr. DBus and systemd
usually only read their files from /usr/ and ignore files in /usr/local.

Now by default, we're asking pkg-config, where to install it. Mostly,
this will be /usr and this conflicts the FHS. But it's the user's intent
to install dunst and (possibly) override the package manager's files
belonging to dunst.

At the current point, even DBus ignores the PREFIX and installs its
systemd service file to the location specified by pkg-config.

@bebehei bebehei requested a review from tsipinakis December 21, 2017 17:53
@bebehei bebehei added this to the v1.3.0 milestone Dec 21, 2017
@bebehei
Copy link
Member Author

bebehei commented Dec 22, 2017

Shitty Ubuntu 14.04. I tested it in a container and I still don't know what the Problem is. It seems, that the version of make doesn't support the Shellstatus variable as expected.

@bebehei
Copy link
Member Author

bebehei commented Dec 22, 2017

Finally got this fixed. Turns out Ubuntu 14 has the old GNU make major version. When reading the docs, it turns out that the SHELLSTATUS variable just got introduced in the recent major.

@bebehei bebehei force-pushed the serviceprefix branch 4 times, most recently from ba19c7e to 976f229 Compare December 22, 2017 10:04
VERSION := $(shell git describe --tags)
endif

SERVICEDIR_DBUS ?= $(shell pkg-config dbus-1 --variable=session_bus_services_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one, dbus dirs are standardized in dbus-daemon(1) and using this ensures that any custom prefix (e.g. ~/.local/share) won't get the dbus service installed.

Copy link
Member Author

@bebehei bebehei Dec 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set SERVICEDIR_DBUS by yourself and and it won't get overwritten then.

@bebehei bebehei requested a review from tsipinakis December 23, 2017 00:27
Copy link
Member

@tsipinakis tsipinakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing missing is some more documentation, if we're going to use some obscure variable that's not even obvious from the Makefile what affects it we should have some good documentation to back that up for confused users.

mkdir -p ${DESTDIR}${PREFIX}/share/dbus-1/services/
install -m644 org.knopwob.dunst.service ${DESTDIR}${PREFIX}/share/dbus-1/services
install -Dm644 dunst.systemd.service ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service
install -Dm644 org.knopwob.dunst.service ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service
Copy link
Member

@tsipinakis tsipinakis Dec 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fatal error if one of these install calls fail, the error condition should be handled both here and in install-systemd and also in uninstall-{dbus,systemd} since it currently stops in the middle of the installation (or uninstallation).

Edit: Furthermore there should be a more user-friendly error message than a big "Permission Denied" error IMO. Especially for the systemd service which is not even necessary to begin with.

PS: Why is the install target called install-service but uninstall uninstall-dbus? weird.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming issue: true, ack.

Permission issue: what!? It's common to start and not check. However it's handled as fatal (like every command in a Makefile).

It's not the makefile's job to check for succession before installation. Also it's (that'll sound hard) not our job to make error messages user friendly. Anyone who's capable to execute make should understand what a permission denied error is.

Copy link
Member

@tsipinakis tsipinakis Dec 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this scenario:

$ PREFIX=install/ SERVICEDIR_DBUS=install/dbus make install
install -Dm755 dunst install//bin/dunst
install -Dm644 docs/dunst.1 install//share/man/man1/dunst.1
install -Dm644 dunstrc install//share/dunst/dunstrc
install -Dm644 org.knopwob.dunst.service install/dbus/org.knopwob.dunst.service
install -Dm644 dunst.systemd.service /usr/lib/systemd/user/dunst.service
install: cannot remove '/usr/lib/systemd/user/dunst.service': Permission denied
Makefile:136: recipe for target 'install-service-systemd' failed
make: *** [install-service-systemd] Error 1

The fact that this means that the installation was successful but couldn't install a very optional part is weird right off the bat.

(Edit: And would probably trip many auto-builders that there is something very wrong if they trip on this for some reason.)

$ find install/
install/
install/bin
install/bin/dunst
install/share
install/share/man
install/share/man/man1
install/share/man/man1/dunst.1
install/share/dunst
install/share/dunst/dunstrc
install/dbus
install/dbus/org.knopwob.dunst.service

All normal here

$ PREFIX=install/ SERVICEDIR_DBUS=install/dbus make uninstall
rm -f install/dbus/org.knopwob.dunst.service
rm -f /usr/lib/systemd/user/dunst.service
rm: cannot remove '/usr/lib/systemd/user/dunst.service': Permission denied
Makefile:150: recipe for target 'uninstall-systemd' failed
make: *** [uninstall-systemd] Error 1

Looks like something didn't run here and indeed uninstallation finished halfway through

$ find install/
install/
install/bin
install/bin/dunst
install/share
install/share/man
install/share/man/man1
install/share/man/man1/dunst.1
install/share/dunst
install/share/dunst/dunstrc
install/dbus

The only reason the install command worked correctly is because install-systemd happened to be the last target to be run it would have exited and might've skipped some steps otherwise.

It's common not to check permissions when we would fail anyway if we can't install that specific part but it's not what's happening here, this is completely optional and it's making it look like something fatal happened.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I have to fully disagree with you. Let me tell you, why:

Let's make an axiom test first.

  • (1) In an unparametrized make call: systemd available <=> systemd service file installed,
  • (2) If you have systemd installed, you want to get valuable information from systemctl status --user dunst.service

Please validate all your statements of your previous comment against those two axioms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to argue the other way but then I realised it's the exact same situation with the dbus service which is pretty crucial. So I give it a pass here.

What I still don't like though is the uninstallation failing mid-way, the same way we use -f to ignore errors on non-existent files we should check and only issue a big warning if there is a permission issue with one of the files not stop completely and leave junk files behind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I still don't like though is the uninstallation failing mid-way,

Err... Failing the installation midway implies, that the installation did not succeed. So, you can't uninstall dunst successfully if your installation failed.

Packing all uninstall targets into a single one and in combination with some shell foo, this can get solved. This ignores all make principles, but it's the only possible solution. I've pushed a commit to this branch now. Let's discuss it.

@bebehei
Copy link
Member Author

bebehei commented Dec 24, 2017

About that docs thing: I thought about this, too. Undocumented vars won't be ever good. Where should I put this? Can you tell me a reasonable place?

@tsipinakis
Copy link
Member

Best place I can think of is the only one we have installation instructions, aka the wiki but since with this PR local installation becomes a bit more complex I'd also add a link to the README pointing that way.

@bebehei bebehei force-pushed the serviceprefix branch 2 times, most recently from a9dc325 to 711864e Compare December 25, 2017 17:19
Setting PREFIX to a location different to /usr, the install routine
fails to install the systemd and dbus service files. These are
installed, but in the PREFIX directory and not /usr. DBus and systemd
usually only read their files from /usr/ and ignore files in /usr/local.

Now by default, we're asking pkg-config, where to install it. Mostly,
this will be /usr and this conflicts the FHS. But it's the user's intent
to install dunst and (possibly) override the package manager's files
belonging to dunst.

At the current point, even DBus ignores the PREFIX and installs its
systemd service file to the location specified by pkg-config.
Dunst does not neccessarily need systemd. Dunst gets started primarily
via DBus. The systemd service is useful on systemd init based systems,
but won't have any impact on non-systemd systems.

To make systemd a soft dependency is neccessary, as pkg-config now also
queries the systemd.pc file, which won't exist on non systemd systems.
Makefile Outdated
rm -f ${DESTDIR}${MANPREFIX}/man1/dunst.1 || ec=1; \
rm -rf ${DESTDIR}${PREFIX}/share/dunst || ec=1; \
rm -f ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service || ec=1; \
if [ "0" != "${SYSTEMD}" ]; then rm -f ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service || ec=1; fi; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't exactly what I meant, more like a "|| echo "WARNING: Failed to remove the {"systemd service file", "dbus service file"}"

@bebehei
Copy link
Member Author

bebehei commented Dec 27, 2017

So, ok. Let's please remind, how manual installation and removal of software works. I'll come back later on this systemd/dbus stuff.

The software gets configured with ./configure --param1 --param2 and the software gets installed with make install. In meantime, the corresponding Makefile had been generated, which remembers the configuration, which resulted of the (parametrized) configure call.

To remove the software again, you have to either:

  • change to the untouched compilation directory and run make uninstall
  • If the compilation directory has been touched after installation, you mostly have to run configure with the same parameterset again and then run make uninstall
  • download the software again, configure it with the same parameters and then run make uninstall

In any case, a successful removal can only be assured, when the last configure call in the compilation directory matches the configure call of the installation.

And here, in dunst's case, this is the same. The advantage of GNU autotools is, that you do not have to actively remember the configure parameters for calling make uninstall.

When we install dunst we have to give the same parameters for make, (sudo) make install and (sudo) make uninstall. This is a bit sad situation, but well it's how it is. We would have to change the buildsystem for this.


Back on the systemd file removal issue:

At this point now, given that make wants to remove the file when the uninstall target gets executed is simply, that the previous make install call with the same configuration has installed the file there.

So, the fact, that make uninstall wants to remove a file, where it does not have permissions, is either, that someone simply forgot sudo (when the person used sudo for make install) or has simply used another file location for this.

It makes no sense, treating some failed removals as fatal and some others not. If dunst fails to remove this file, it fails to remove this file, because you either did not specify the params correctly or have forgot sudo.

@tsipinakis
Copy link
Member

tsipinakis commented Dec 28, 2017

I agree with what you said but there's just one point demonstrated by the example above:

At this point now, given that make wants to remove the file when the uninstall target gets executed is simply, that the previous make install call with the same configuration has installed the file there.

Or option 2 is that an installation was attempted (but failed because the user forgot to set the right variables, usual mistake given they aren't that common) and now they can't remove the already installed files because uninstallation tries to remove the systemd stuff first (and fails).

Sure, you can just sudo it or dig the Makefile to look for everything that's being installed and remove it manually but that misses the point of the uninstall target.

EDIT: I guess I agree that it doesn't make much sense to treat some files special like this but I feel it's justified for these 2 since a) they are controlled by some pretty obscure variables and b) there is no easy to use configure script for dunst so everything's in environment variables.

@tsipinakis
Copy link
Member

We've already delayed the release of 1.3 by a lot and I've been arguing about a very rare scenario for a few days now so I'm approving this (I've removed the last experimental commit you pushed in response to my argument).

I also realised a lot of this could also easily be resolved with some better documentation so I'd also make it a goal to add some more detailed installation instructions to the repo, maybe in README or a separate file.

I've approved this but I'm leaving the merge up to you since I did remove a commit without your approval.

@bebehei bebehei merged commit 65043c0 into dunst-project:master Dec 28, 2017
@bebehei bebehei deleted the serviceprefix branch December 29, 2017 03:23
karlicoss pushed a commit to karlicoss/dunst that referenced this pull request Mar 21, 2019
Add configurable path variables for services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants