Skip to content

Profiles not visible after restart: bsd_glob() unreliable for profile discovery #820

Description

@markbain

Summary

On some systems, bsd_glob() called without explicit flags fails to expand wildcard patterns and returns the literal pattern string instead of matching files. This causes Shutter's profile combobox to show only a single entry named * after restart — all saved profiles are invisible.

Steps to reproduce

  1. Create one or more profiles via Preferences
  2. Quit Shutter fully (via tray → Quit)
  3. Relaunch Shutter
  4. Open Preferences — profile combobox shows only *, no saved profiles listed

Root cause

Line 888 of /usr/bin/shutter:

foreach my $pfile (sort bsd_glob("$ENV{'HOME'}/.shutter/profiles/*.xml")) {

bsd_glob() without explicit flags has platform-dependent default behaviour. On affected systems it returns the literal string ~/.shutter/profiles/*.xml when the flags default in a way that triggers GLOB_NOCHECK-style fallback. Perl's built-in glob() does not have this variance.

Reproducing the difference in Perl:

use File::Glob qw(bsd_glob);
# Returns literal '*.xml' pattern on affected systems:
my @a = bsd_glob("$ENV{'HOME'}/.shutter/profiles/*.xml");

# Returns all matching files correctly:
my @b = glob("$ENV{'HOME'}/.shutter/profiles/*.xml");

Fix

Replace bsd_glob with the built-in glob on line 888:

# Before
foreach my $pfile (sort bsd_glob("$ENV{'HOME'}/.shutter/profiles/*.xml")) {

# After
foreach my $pfile (sort glob("$ENV{HOME}/.shutter/profiles/*.xml")) {

glob() is the idiomatic Perl choice for simple patterns and delegates to File::Glob internally on modern Perl without the flag-dependent variance. No other behaviour is affected — the pattern doesn't use brace expansion or any feature exclusive to bsd_glob.

Environment

  • Shutter 0.99.2 Rev.1593
  • Perl (system), Linux/Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions