ahupp / ahupp/python-magic

magic.from_file(file) generate "File Not Found" exception when file is a linux (symbolic) link

Open
#336 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
304
PR merge metrics
No merged PRs in 30d

Description

On a Linux/Ubuntu platform, if file is a symbolic link, magic.from_file(file) will throw a FileNotFoundError, instead of detecting that file is a link (inode/symlink).

So far, the only workaround I found is to embed the code containing the magic.from_file(file) line into a try/except block, and catch the exception.

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the magic.from_file(file) behavior on Linux/Ubuntu with a symbolic link. Trace the magic.from_file entry point and determine how symlink paths are handled; done means the reported link case no longer raises FileNotFoundError and has a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.