pimutils / pimutils/vdirsyncer

post_hook in [storage] section for type = filesystem doesn't work

Open
#1,024 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
185
Avg merge
11h 49m
Merged PRs (30d)
1

Description

As far as i know pythons subprocess.call can only execute single commands that way. Executing a more complex command needs shell=True to be set. Furthermore its sometimes useful to specify the path within the command so maybe call subprocess.call like this in FilesystemStorage._run_post_hook:

subprocess.call(self.post_hook.format(fpath), shell=True)

so one can specify a post_hook like this:

post_hook = "/bin/sed -r -i -e '/UID:.*/a CATEGORIES:collected' {0}"

well, in this case, it wouldn't matter, but in other circumstances it might :-)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at FilesystemStorage._run_post_hook and inspect how post_hook is currently passed to subprocess.call. Verify the behavior with a post_hook containing a shell command and a formatted filesystem path, then confirm that the filesystem storage hook executes it as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.