我正在使用tarfile
模块检查我的焦油gz文件。
我的问题有两个方面。在
权限位值与从ls -l
命令获得的值不同。从list
命令中,值是755
。但我的程序中有488
。我使用下面的命令功能-
def checkAndExtratZipFile (value,packageElementInfoList):
try:
tar = tarfile.open(value,"r:gz")
for tarinfo in tar:
global elementType
# Populate all information about the element
name = tarinfo.name
size = tarinfo.size
perm = tarinfo.mode
if tarinfo.isdir():
eleType = elementType.Directory
elif tarinfo.issym():
eleType = elementType.SymbolicLink
else:
eleType = elementType.File
# Populate into list
packageElementInfoList.append(packageElementInfo(name,eleType,perm,size))
tar.close()
except:
print "Verification of package %s failed.\n Reason : Not able to read contents in the tar package." % value
sys.exit(1)
我的系统(在SUSE Linux上工作)将有要验证的包,这些包是由SUSE/AIX和HP平台创建的。所以我需要在Linux服务器上验证在AIX/HP/Linux平台上构建的包。
Linux上AIX/HP包的权限位非常奇怪,755
权限位是33256
。在
感谢任何帮助。在
你看到的是以10为基数的八进制数表示:
您需要使用
^{pr2}$stat
模块上的属性检查标志:相关问题 更多 >
编程相关推荐