Project

General

Profile

Bug #16821

Electrum wrapper's persistence check is wrong

Added by anonym 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Persistence
Target version:
Start date:
Due date:
% Done:

100%

Feature Branch:
Type of work:
Code
Blueprint:
Starter:
Affected tool:
Electrum

Description

It looks like this:

def electrum_config_is_persistent():
    filesystem = sh.findmnt('--noheadings',
                            '--output', 'SOURCE',
                            '--target', CONF_DIR).stdout.decode().strip()
    return filesystem in sh.glob('/dev/mapper/TailsData_unlocked[/electrum]')

It does not make sense to do that glob expansion, which will try to match against these:

  • /dev/mapper/TailsData_unlocked/
  • /dev/mapper/TailsData_unlockede
  • ...
  • /dev/mapper/TailsData_unlockedu
  • /dev/mapper/TailsData_unlockedm

of which none will match anything. Due to a bug in stretch's python3-sh (version 1.11-1) sh.glob(e) returns e when there is no match, but it should clearly return the empty list, which it does in buster's version (1.12.14-1.1). The correct check is filesystem == '/dev/mapper/TailsData_unlocked[/electrum]', and that the old check works in stretch is just a coincidence due to that bug.

Associated revisions

Revision ecff6954 (diff)
Added by anonym 3 months ago

Fix Electrum wrapper's persistence check.

The output of findmnt is not glob-expandable -- the [...] suffix is
findmnt's ad-hoc way to represent bind mounts.

Fix-committed: #16821

History

#1 Updated by anonym 3 months ago

The correct check is filesystem == '/dev/mapper/TailsData_unlocked[/electrum]'

Clarification: the above is the expected findmnt output, which isn't intended as something glob-expandable -- the [...] suffix is just findmnt's way to express bind mounts.

#2 Updated by anonym 3 months ago

  • Target version changed from Tails_3.15 to Tails_4.0

We'll ignore this situation for stretch since it works (by coincidence).

#3 Updated by anonym 3 months ago

  • Status changed from Confirmed to Fix committed
  • % Done changed from 0 to 100

#4 Updated by intrigeri 3 months ago

  • Status changed from Fix committed to Resolved

Also available in: Atom PDF