bug-parted
[Top][All Lists]
Advanced

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

bug#32810: It 100% Bug (Output contains controlled symbols)


From: ПИван Петров
Subject: bug#32810: It 100% Bug (Output contains controlled symbols)
Date: Mon, 24 Sep 2018 17:42:14 +0300

If replace "parted --machine /dev/sdb unit B print free quit" execution by Python script:
#========== Python script =====================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import subprocess;

def GetPartedOutput(diskPath):
result = {}
commandParams = ['parted', '--machine', diskPath, \
'unit', 'B', 'print', 'free', 'quit']

runObj = subprocess.run(commandParams, \
stdout=subprocess.PIPE, \
stderr=subprocess.PIPE, \
check=True)
errorsOutput = runObj.stderr.decode('utf-8')
output = runObj.stdout.decode('utf-8')
hexiText = "".join("({}_{:02x})".format(letter, ord(letter)) for letter in output)
print(errorsOutput + output)
print('========== hexiText ==========')
print('ou:' + hexiText + ':ou')

GetPartedOutput('/dev/sdb')
#========== End Python script ==================================

================ Then will be Output: ==============
address@hidden:/home/user# '/home/user/Рабочий стол/test.py' 
Ошибка: /dev/sdb: метка диска не определена
BYT;                                                                      
/dev/sdb:1073741824B:scsi:512:512:unknown:VMware, VMware Virtual S:;

========== hexiText ==========
_0d)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)( _20)_0d)(B_42)(Y_59)(T_54)(;_3b)()( _20)( _20)( _20)(
_0a)(/_2f)(d_64)(e_65)(v_76)(/_2f)(s_73)(d_64)(b_62)(:_3a)(1_31)(0_30)(7_37)(3_33)(7_37)(4_34)(1_31)(8_38)(2_32)(4_34)(B_42)(:_3a)(s_73)(c_63)(s_73)(i_69)(:_3a)(5_35)(1_31)(2_32)(:_3a)(5_35)(1_31)(2_32)(:_3a)(u_75)(n_6e)(k_6b)(n_6e)(o_6f)(w_77)(n_6e)(:_3a)(V_56)(M_4d)(w_77)(a_61)(r_72)(e_65)(,_2c)( _20)(V_56)(M_4d)(w_77)(a_61)(r_72)(e_65)( _20)(V_56)(i_69)(r_72)(t_74)(u_75)(a_61)(l_6c)( _20)(S_53)(:_3a)(;_3b)(
_0a):ou
=============== End Output ===========================

1. This "Output" contains "Carrage return" as 1st simbol
2. Then contains a lot of spaces.
3. After "BYT;" - has symbol, that i can't recognaize (I am not cool Python programmer :-) )
4 and than goes 3 spaces (after this symbol)

I think, that it is very bad output/ These symbols not must be in output!!!

PS: Before, i rebooted and a lot of spaces was after "BYT;" (but i have not this python script)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]