Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

How to preserve pip install temporary directory for error analyse?

+0
−0

Here I am trying to install a pip package.

While installation, pip tries to compile something.

With meson.

Meson calls cmake.

Cmake fails on a missing dependency.

Then, meson fails on the failed cmake.

Then, pip fails on the failed meson.

Then, pip deletes the temporary directory for the compilation and exits.

On this way, I can not see the meson logs, exactly what failed.

How to break this chain? I believe, pip should not deleted anything if I specify it on this way.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

I have found `pip --no-clean`, but it still does not work. Most importantly, pip has created about 5 ... (1 comment)

1 answer

+1
−0

Honestly I have a solution, but honestly I could not give a medal for their work to the pip devs.

  1. Pip has a --no-clean flag. On the docs, it preserves the temporary directories for further analyse. In the reality, it preserves only some of them, and the others will be still deleted. But that is a good first try - if you have luck, you can find what you want to.

  2. Somewhere I have also read, pip actually has configuration files, whose pathes you can get with the command pip config -v list. It has a .ini syntax and there are multiple places where you can ask pip to not delete things.

  3. And this is what I have done. I have executed pip with hooking the deletion-related libc calls to a doing-nothing function. On this way, pip could not delete anything, note it might cause problems in the compilation, but it is also a working method. The steps are:

3.1. Create a .c file with this, for example with the name hook.c:

int unlink(char* path) {
  return 0;
}

int unlinkat(int dirfd, char* pathname, int flags) {
  return 0;
}

int rmdir(char* path) {
  return 0;
}

Then compile it to shared lib with the command gcc -shared -o hook.so hook.c.

Now, if you execute any command by prefixing it with a LD_PRELOAD=/path/to/hook.so pip ...., then it won't be able to delete anything any more. But it will think, it could. All the file or directory related libc calls will return success - but actually without doing anything.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »