#490 listpaths error:
Opened a year ago by eclipseo. Modified a year ago

So I have:

rpm -ql --dump --nosignature -p /home/bob/packaging/review/musescore/review-musescore/results/musescore-soundfont-0.2.0-1.fc40.noarch.rpm                                       (base)  0s  fish 
/usr/share/mscore-4.1/sound 0 1690416000 0000000000000000000000000000000000000000000000000000000000000000 040755 root root 0 0 0 X
/usr/share/mscore-4.1/sound/MS Basic.sf3 51278610 1690310306 5ea2375e8bd7d8e71def1036978c1621e85b66934169b6a2744b27b9b3c2d99c 0100644 root root 0 0 0 X
/usr/share/soundfonts/MS Basic.sf3 32 1690416000 0000000000000000000000000000000000000000000000000000000000000000 0120777 root root 0 0 0 ../mscore-4.1/sound/MS Basic.sf3

this result get passed to listpaths on deps.py

def listpaths(pkg_filename):
    """Return lists of files and dirs in local pkg."""

    cmd = ["rpm", "-ql", "--dump", "--nosignature", "-p", pkg_filename]
    Settings.get_logger().debug("Running: %s", " ".join(cmd))
    try:
        rpm = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
    except OSError:
        Settings.get_logger().warning("Cannot run %s", " ".join(cmd))
        return []
    files = []
    dirs = []
    while True:
        try:
            line = next(rpm.stdout).strip()
        except StopIteration:
            return dirs, files
        try:
            path, mode = line.rsplit(None, 10)[0:5:4]
        except ValueError:
            # E. g., when given '(contains no files)'
            continue
        mode = int(mode, 8)
        if mode & 0o40000:
            dirs.append(path)
        else:
            files.append(path)

we have some stuff to extract the path and the mode: path, mode = line.rsplit(None, 10)[0:5:4]

But this fails in this case:

>> line="/usr/share/soundfonts/MS Basic.sf3 32 1690416000 0000000000000000000000000000000000000000000000000000000000000000 0120777 root root 0 0 0 ../mscore-4.1/sound/MS Basic.sf3"
>>> path, mode = line.rsplit(None, 10)[0:5:4]
>>> path
'/usr/share/soundfonts/MS Basic.sf3 32'

we split by space with a max of 10 split:

line.rsplit(None, 10)
['/usr/share/soundfonts/MS Basic.sf3 32', '1690416000', '0000000000000000000000000000000000000000000000000000000000000000', '0120777', 'root', 'root', '0', '0', '0', '../mscore-4.1/sound/MS', 'Basic.sf3']

That's not good.


Log in to comment on this ticket.

Metadata
Related Pull Requests
  • #492 Merged a year ago
  • #491 Merged a year ago