GithubHelp home page GithubHelp logo

informant's Issues

Use psutil instead of shelling out to ps

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.

Why does informant need sudo?

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)?

News comes in too late

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:

  1. Is it possible to fail on news earlier?
  2. Is there a reason why we don't?

Unable to save read information in informant.dat

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".

Improve informant read

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?

Computer froze during pacman install, informant now hangs infinitely

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.

Informant prevents installation from local cache if there is no internet connection

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).

Fails after Python 3.10 update

:: 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

informant version

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:

ARGV = docopt.docopt(__doc__, version='informant v0.2.0')

Add ability to use shortened commands

Hello there!

Is it possible to add the option to use shortened commands? For example:

  • instead of running informant check, run informant c;
  • instead of running informant list, run informant l;
  • instead of running informant read 0, run informant r 0

Display name of package or `informant read` command

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.

informant is not the first pre-transaction hook that gets run

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?

Warn instead of breaking during offline operations

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)

Unable to read cache information: ("Connection broken: PermissionError(13, 'Permission denied')", PermissionError(13, 'Permission denied'))

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!

[Solved] Error with "informant read --all"

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 informantgroup.

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 fails after major Python upgrade

`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

`

Partial update when aborting update due to unread news

Consider the situation:

  1. User runs update.
  2. Pacman sync the local package database.
  3. Informant hook is run, and it detects unread news, aborting the update.
  4. User reads the news.
  5. User installs a new package on an outdated system, causing a partial update scenario, potentially breaking the system.

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.

Error from CacheControl when permissions fail on cache directory

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.