Skip to content

Fix crash on NixOS for the kdev-php plugin

Aaron Andersen requested to merge aandersen/kdevelop:master into master

Issue: When running the kdev-php plugin on NixOS kdevelop instantly crashes with this error:

importing internalFunctions failed "/run/current-system/sw/share/kdevphpsupport/phpunitdeclarations.php"

This file is supposed to be an internal file and parsed even though it is larger than the 5MB limit, but it is not considered an internal file on NixOS because...

On NixOS:

  • /run/current-system/sw/share/kdevphpsupport/phpunitdeclarations.php is a symlink to /nix/store/some-long-hash-kdev-php-5.3.1/share/kdevsupport/phpunitdeclarations.php
  • (one of) the value(s) for QStandardPaths::standardLocations(QStandardPaths::StandardLocation::GenericDataLocation) is /run/current-system/sw/share/

The original check if (internalFilePath.startsWith(dataPath.canonicalPath() + QStringLiteral("/kdev"))) { will resolve symlinks and then the comparison will not pass. NixOS requires a version of this check which does not resolve symlinks, and this merge request implements that.

I have tested these changes on my NixOS system and with the changes kdevelop no longer crashes when running the kdev-php plugin.

Merge request reports