bradford-smith94 / informant Goto Github PK
View Code? Open in Web Editor NEWAn Arch Linux News reader and pacman hook
License: MIT License
An Arch Linux News reader and pacman hook
License: MIT License
I'm not sure if this is supposed to happen, but when I run a pacman command, when it hits "Checking ArchLinux news", it hangs for a few seconds before moving on.
I suppose it is now reading the webpage from Arch Linux News.
What if we add a config to it that provides an URL?
Can it be adapted to read that too?
pacman -Syu
fails today due to https://www.archlinux.org/news/xorg-cleanup-requires-manual-intervention/
It fails before informant
can tell me to read the news, I'm wondering if this is a one-off case where updating fails before the pre-transaction hook?
The current code uses the subprocess module to invoke ps
commands for process management. We should consider replacing these subprocess calls with the psutil
library, which is not part of the standard library but provides a more robust interface for interacting with system processes.
Using psutil
over subprocess to call ps
has some advantages. Directly using psutil
avoids the risks associated with parsing shell command output, which can be unstable. You have no mechanism to check or pin external shell dependencies like you do with python modules.
Frustrating when I'm trying to downgrade the kernel in recovery mode. Downgrades should not be blocked by informant.
I was wondering if there is a specific reason why informant requires root privileges or membership in the informant
group.
AFAIK that command doesn't do any changes to the system. And since the displayed news are publicly available on the arch website, this seems like an odd choice to me.
If this is meant to protect admins against users maliciously reading the news (something I never thought I'd write ๐ ), wouldn't it be more desirable to keep the data in the users home directory (like PR #17 suggests)?
Firstly, this isn't necessarily an issue with Informant. It seems to be working okay (perhaps).
Today I tried a pacman -Syu
and got the following error:
error: failed to commit transaction (conflicting files)
libxml2: /usr/lib/python3.10/site-packages/__pycache__/drv_libxml2.cpython-310.pyc exists in filesystem
libxml2: /usr/lib/python3.10/site-packages/__pycache__/libxml2.cpython-310.pyc exists in filesystem
Errors occurred, no packages were upgraded.
My first (probably incorrect) instinct was to delete these files. Rerunning the command then resulted in this:
:: Running pre-transaction hooks...
(1/3) Checking Arch News with Informant ...
:: informant: Stopping upgrade to print news
libxml2>=2.9.12-6 update may require manual intervention
Mon, 27 Dec 2021 06:17:35 +0000
The libxml2 package prior to version 2.9.12-6 was missing the compiled python
modules. This has been fixed in 2.9.12-6, so the upgrade may need to overwrite any
untracked pyc files created. If you get errors like these
libxml2: /usr/lib/python3.10/site-packages/__pycache__/drv_libxml2.cpython-310.opt-1.pyc exists in filesystem
libxml2: /usr/lib/python3.10/site-packages/__pycache__/drv_libxml2.cpython-310.pyc exists in filesystem
libxml2: /usr/lib/python3.10/site-packages/__pycache__/libxml2.cpython-310.opt-1.pyc exists in filesystem
libxml2: /usr/lib/python3.10/site-packages/__pycache__/libxml2.cpython-310.pyc exists in filesystem
when updating, use
pacman -Syu --overwrite /usr/lib/python3.10/site-packages/__pycache__/\*
to perform the upgrade.
:: informant: You can re-run your pacman command to complete the upgrade
error: command failed to execute correctly
error: failed to commit transaction (failed to run transaction hooks)
Errors occurred, no packages were upgraded.
Which would have been pretty useful to have seen before :)
I installed Informant via the AUR, so my questions are:
On running informant read 0
on first use it returns the following error:
ERROR: Unable to save read information, please re-run with correct permissions to access "/var/cache/informant.dat".
Couldn't informant read
just have to be run once, and we hit Space
or a key to confirm reading each of the 10 news post's instead of something like for run in {1..10}; do informant; done
?
I was in the middle of fixing one of my AUR packages, I ran makepkg -si and my pc froze sometime after the pre transaction hooks. Informant is causing some unexpected behavior since it now hangs forever during any operation even with sudo. This is all I can get out of it now. Network does not seem to matter, but it does fail when no network is present.
$ sudo informant -d check
Getting datfile from "/var/lib/informant.dat"
cfg_fname: None
config: {}
cli args: {'--all': False,
'--config': None,
'--debug': True,
'--file': None,
'--help': False,
'--no-cache': False,
'--raw': False,
'--reverse': False,
'--unread': False,
'--version': False,
'<item>': None,
'check': True,
'list': False,
'read': False}
Removing /var/lib/informant.dat or reinstalling does nothing.
Trying to reinstall a package from the local cache without internet connection (I broke systemd-networkd...), Informant popped up with the following error:
: Running pre-transaction hooks...
(1/2) Checking Arch News with Informant ...
Unable to read cache informantion: HTTPSConnectionPool(host='archlinux.org', port=443): Max retries exceeded with url: /feeds/news/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f1ee58406a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Encountered feed error: <urlopen error [Errno -2] Name or service not known>
error: command failed to execute correctly
error: failed to commit transaction (failed to run transaction hooks)
Errors occurred, no packages were upgraded.
I think informant should only warn without preventing the installation if it cannot retrieve the RSS feed (at least when doing a local installation, but I don't think this can be easily detected).
When updating AUR stuff I use the command Yay most of the time.
Does this work too with a AUR helper like yay?
:: Running pre-transaction hooks...
(1/1) Checking Arch News with Informant ...
Traceback (most recent call last):
File "/usr/bin/informant", line 33, in <module>
sys.exit(load_entry_point('informant==0.4.5', 'console_scripts', 'informant')())
File "/usr/bin/informant", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 919, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 518, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for informant
error: command failed to execute correctly
error: failed to commit transaction (failed to run transaction hooks)
Errors occurred, no packages were upgraded.
Done - Press enter to exit
Hello, I think there is an error in informant --version
output. I recently updated to version v0.2.2
But I get the version to be v0.2.0
when I run informant in my terminal:
$ informant --version
informant v0.2.0
Probably the error is due to the below code:
Line 301 in 96ef291
Hello there!
Is it possible to add the option to use shortened commands? For example:
informant check
, run informant c
;informant list
, run informant l
;informant read 0
, run informant r 0
I like this package, but I find every time it prevents me from upgrading (as intended) I forget the name of the package so I can't do informant read
! If it reminded the user of the command when it prevents an upgrade that would be lovely.
I noticed this the last time I went to update:
:: Running pre-transaction hooks...
(1/3) Removing linux initcpios...
(2/3) Remove DKMS modules
==> dkms remove acpi_call/1.1.0 -k 5.5.3-arch1-1
==> dkms remove vboxhost/6.1.2_OSE -k 5.5.3-1-ck-broadwell
==> dkms remove acpi_call/1.1.0 -k 5.5.3-1-ck-broadwell
==> dkms remove vboxhost/6.1.2_OSE -k 5.5.3-arch1-1
(3/3) Checking Arch News ...
sshd needs restarting after upgrading to openssh-8.2p1
Mon, 17 Feb 2020 01:35:04 +0000
After upgrading to openssh-8.2p1, the existing SSH daemon will be unable to accept
new connections. (See [FS#65517][1].) When upgrading remote hosts, please make sure
to restart the SSH daemon using `systemctl restart sshd` right after running `pacman
-Syu`. If you are upgrading to openssh-8.2p1-3 or higher, this restart will happen
automatically.
[1]: https://bugs.archlinux.org/task/65517
error: command failed to execute correctly
error: failed to commit transaction (failed to run transaction hooks)
Errors occurred, no packages were upgraded.
Error installing repo packages
So stuff already starts happening before the hook gets a chance to run and stop things. So potentially it could fail to serve its purpose -- to prevent any changes before the user has a chance to read any relevant news. Is there a way to make sure the informant hook is run first?
Running pacman -U
with packages from the cache (coincidentally trying to solve network issues) fails:
(1/3) Checking Arch News ...
<urlopen error [Errno -3] Temporary failure in name resolution>
I assume this is because I'm not connected to the internet, but I'm running an operation that would otherwise not require internet access. Now I need to temporarily disable informant to be able to perform this operation. Can Informant catch these errors and warn about missing internet access instead of breaking?
(can confirm, after -Rns informant
, the installation works flawlessly)
On two different machines I have this error every time I run informant check
:
$ informant check
ERROR: Unable to read cache information: ("Connection broken: PermissionError(13, 'Permission denied')", PermissionError(13, 'Permission denied'))
ERROR: Encountered feed error: <unknown>:6:-1: Opening and ending tag mismatch: hr line 6 and body
WARN: no news feed items, informant is performing no action
What could be the cause of this? Thank you!
Hi,
I got this error on 4 different Arch machines, all having the same output:
$ informant read --all
Traceback (most recent call last):
File "/usr/bin/informant", line 33, in <module>
sys.exit(load_entry_point('informant==0.4.2', 'console_scripts', 'informant')())
File "/usr/lib/python3.9/site-packages/informant/informant.py", line 178, in main
run()
File "/usr/lib/python3.9/site-packages/informant/informant.py", line 171, in run
read_cmd(feed)
File "/usr/lib/python3.9/site-packages/informant/informant.py", line 120, in read_cmd
entry.mark_as_read(entry)
TypeError: mark_as_read() takes 1 positional argument but 2 were given
This happened a couple of weeks ago, around maybe v0.4 update?
The user is in the informant
group.
Also:
$ ls -ld /var/cache/informant
drwxrwsr-x 4 root informant 4096 Feb 7 11:08 /var/cache/informant
Could you please kindly take a look to see if it's a bug?
Thank you.
`informant check
Traceback (most recent call last):
File "/usr/bin/informant", line 33, in
sys.exit(load_entry_point('informant==0.4.5', 'console_scripts', 'informant')())
File "/usr/bin/informant", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib/python3.10/importlib/metadata/init.py", line 919, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib/python3.10/importlib/metadata/init.py", line 518, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for informant
`
Consider the situation:
Aborting updates is the same as running pacman -Sy
, it should never be done, unless the system is updated immediately afterwards. There is no guarantee for that with this hook.
Heloo, after installing informant via yay
and running informant check
the following output was presented to me:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/lockfile/linklockfile.py", line 19, in acquire
open(self.unique_name, "wb").close()
FileNotFoundError: [Errno 2] No such file or directory: '/var/cache/informant/a/3/a/4/1/peterbabic-b8ddc740.52293122153530957582761'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/informant", line 33, in <module>
sys.exit(load_entry_point('informant==0.4.1', 'console_scripts', 'informant')())
File "/usr/lib/python3.9/site-packages/informant/informant.py", line 176, in main
run()
File "/usr/lib/python3.9/site-packages/informant/informant.py", line 160, in run
feed = Feed().entries
File "/usr/lib/python3.9/site-packages/informant/feed.py", line 47, in __init__
self.feed = self.fetch() # the complete feed as returned by feedparser
File "/usr/lib/python3.9/site-packages/informant/feed.py", line 69, in fetch
return feedparser.parse(session.get(self.url).content)
File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3.9/site-packages/cachecontrol/adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 533, in send
return self.build_response(request, resp)
File "/usr/lib/python3.9/site-packages/cachecontrol/adapter.py", line 97, in build_response
self.controller.cache_response(request, response)
File "/usr/lib/python3.9/site-packages/cachecontrol/controller.py", line 316, in cache_response
self.cache.set(cache_url, self.serializer.dumps(request, response))
File "/usr/lib/python3.9/site-packages/cachecontrol/caches/file_cache.py", line 126, in set
with self.lock_class(name) as lock:
File "/usr/lib/python3.9/site-packages/lockfile/__init__.py", line 197, in __enter__
self.acquire()
File "/usr/lib/python3.9/site-packages/lockfile/linklockfile.py", line 21, in acquire
raise LockFailed("failed to create %s" % self.unique_name)
lockfile.LockFailed: failed to create /var/cache/informant/a/3/a/4/1/peterbabic-b8ddc740.52293122153530957582761
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.