博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
files list file for package 'xxx' is missing final newline
阅读量:4451 次
发布时间:2019-06-07

本文共 1539 字,大约阅读时间需要 5 分钟。

#!/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.pyimport osdpkg_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:] != '\n':        f.write('\n')        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

 

转载于:https://www.cnblogs.com/yanghuahui/p/5091861.html

你可能感兴趣的文章
HTML撑起浮动子元素得父元素高度
查看>>
LeetCode--018--四数之和(java)
查看>>
Redis消息队列
查看>>
电商网站架构设计
查看>>
http://jingyan.baidu.com/article/4dc40848e7b69bc8d946f127.html
查看>>
WCF netTcp配置
查看>>
单例类
查看>>
python 正则表达式 提取网页中标签的中文
查看>>
LA 2531 The K-league 最大流
查看>>
从零开始学习前端JAVASCRIPT — 6、JavaScript基础DOM
查看>>
Edit显示行号
查看>>
取得字符串中指定的字符str[]
查看>>
delphi TOpenDialog
查看>>
static关键字用法
查看>>
JVM调优总结
查看>>
git安装和使用
查看>>
数据类型转换
查看>>
Nodejs学习笔记(2) 阻塞/非阻塞实例 与 Nodejs事件
查看>>
跟我一起读postgresql源码(六)——Executor(查询执行模块之——查询执行策略)
查看>>
scala的4中for循环,及while和do while循环
查看>>