Commit 6217001b authored by Axel Beckert's avatar Axel Beckert

Harden generate-flwm-menu-from-desktop-files against broken .desktop files

parent bf60bf99
flwm (1.02+git2015.10.03+7dbb30-3) UNRELEASED; urgency=medium
* Harden generate-flwm-menu-from-desktop-files against more kinds of
broken .desktop files to avoid upgrade issues.
-- Axel Beckert <abe@debian.org> Sat, 23 Dec 2017 02:27:58 +0100
flwm (1.02+git2015.10.03+7dbb30-2) unstable; urgency=medium
* Set "Rules-Requires-Root: no".
......
......@@ -60,7 +60,19 @@ $target_dir->mkpath;
my @desktop_files = $desktop_dir->children( qr{ \.desktop $ }x );
foreach my $desktop_file (@desktop_files) {
my $desktop_entry = File::DesktopEntry->new($desktop_file);
my $desktop_pt = path($desktop_file);
# Weed out broken symbolic links
next unless $desktop_pt->exists;
# Filter out localized non-UTF-8 values as they tend to make
# File::DesktopEntry to barf and we don't need them anyways.
my $desktop_raw = join('',
grep { !/\.(CP1251|KOI8-)/ }
$desktop_pt->lines);
# Finally parse the file
my $desktop_entry = File::DesktopEntry->new(\$desktop_raw);
# Skip files without Exec, Name or Type entry
next unless defined $desktop_entry->get('Exec');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment