mirror of
https://git.proxmox.com/git/grub2
synced 2025-08-02 15:36:35 +00:00
sh -ec is only appropriate for /etc/default/grub, not /etc/grub.d/*
This commit is contained in:
parent
a5cee8c7d7
commit
f4f0a8e903
11
debian/apport/source_grub2.py
vendored
11
debian/apport/source_grub2.py
vendored
@ -14,6 +14,15 @@ import subprocess
|
||||
import re
|
||||
|
||||
def check_shell_syntax(path):
|
||||
''' Check the syntax of a shell script '''
|
||||
try:
|
||||
subprocess.check_call(['/bin/sh', '-n', path],
|
||||
stderr=open(os.devnull,'w'))
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_shell_syntax_harder(path):
|
||||
''' Check the syntax of a shell script '''
|
||||
try:
|
||||
# sh -n is tempting, but not good enough. Consider this case:
|
||||
@ -57,7 +66,7 @@ def add_info(report):
|
||||
attach_file_if_exists(report, '/boot/grub/device.map', 'DeviceMap')
|
||||
|
||||
invalid_grub_script = []
|
||||
if not check_shell_syntax('/etc/default/grub'):
|
||||
if not check_shell_syntax_harder('/etc/default/grub'):
|
||||
invalid_grub_script.append('/etc/default/grub')
|
||||
|
||||
# Check scripts in /etc/grub.d since some users directly change
|
||||
|
Loading…
Reference in New Issue
Block a user