zoukankan      html  css  js  c++  java
  • files list file for package 'xxx' is missing final newline

    #!/usr/bin/python
    
    
    # 8th November, 2009
    # update manager failed, giving me the error:
    #       'files list file for package 'xxx' is missing final newline' for every package.
    # some Googling revealed that this problem was due to corrupt files(s) in /var/lib/dpkg/info/
    # looping though those files revealed that some did not have a final new line
    # this script will resolve that problem by appending a newline to all files that are missing it
    # NOTE: you will need to run this script as root, e.g. sudo python newline_fixer.py
    
    import os
    
    dpkg_path = '/var/lib/dpkg/info/'
    paths = os.listdir(dpkg_path)
    for path in paths:
        path = dpkg_path + path
        f = open(path, 'a+')
        data = f.read()
        if len(data) > 1 and data[-1:] != '
    ':
            f.write('
    ')
            print 'added newline character to:', path
        f.close() 

    Ok, i've had this error for several weeks now and have not been able to install ANY updates. Did some searching and couldn't find much info, so decided to check it out myself. The 'missing final newline' was a bit of a giveaway really, so i created a python script to check how many files inside /var/lib/dpkg/info/ were actually missing the final newline character.

    I then modified my script to append a newline to the files that were missing it, which fixed my problem. Not sure how these files managed to get corrupted but hey-ho. Is this a satisfactory answer or will i be misleading new users by posting this script???

    refer to:  http://ubuntuforums.org/showthread.php?t=1319791

  • 相关阅读:
    PHP代码审计-command injection-dvwa靶场
    PHP代码审计-Brute Force-dvwa靶场
    PHP代码审计-XSS
    Linux下安装SQLServer2019
    Linux--每日一个跑路小命令之 chmod 000 -R /
    linux的小命令-fuck
    uni-app 页面样式与布局
    uni-app内置基础组件
    uni-app pages.json常用配置
    uni-app项目目录和文件作用
  • 原文地址:https://www.cnblogs.com/yanghuahui/p/5091861.html
Copyright © 2011-2022 走看看