[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#913001: live-wrapper: Handle firmware list more robustly by using proper whitespace split



Package: live-wrapper
Version: 0.7
Severity: normal
Tags: patch

Hi,

Patch against current master branch in attachement.

"
    Fix splitting of firmare package names
    
    split(' ') literally splits on a single space:
    
    'firmware-a  firmware-b'.split(' ') == ['firmware-a', '', 'firmware-b']
    
    Use split() that automatically removes empty elements (equivelent to
    strip + remove if empty), and splits on tabs and newlines.
    
    This makes human provided arguments be handled more robustly.
"

Thanks.
commit dc2c8f3376fafcc35846f2e75a4c4f6393bb3590
Author: Witold Baryluk <witold.baryluk@gmail.com>
Date:   Mon Nov 5 19:27:08 2018 +0000

    Fix splitting of firmare package names
    
    split(' ') literally splits on a single space:
    
    'firmware-a  firmware-b'.split(' ') == ['firmware-a', '', 'firmware-b']
    
    Use split() that automatically removes empty elements (equivelent to
    strip + remove if empty), and splits on tabs and newlines.
    
    This makes human provided arguments be handled more robustly.

diff --git a/lwr/run.py b/lwr/run.py
index a2fe103..0982f5f 100644
--- a/lwr/run.py
+++ b/lwr/run.py
@@ -322,7 +322,7 @@ class LiveWrapper(cliapp.Application):
                                       self.settings['mirror'],
                                       self.settings['distribution'],
                                       self.settings['architecture'])
-            for pkg in self.settings['firmware'].split(' '):
+            for pkg in self.settings['firmware'].split():
                 filename = handler.download_package(pkg, fw_root)
             handler.clean_up_apt()
             logging.info("... firmware deb downloads")

Reply to: