question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--config` doesn't accept VFS files

See original GitHub issue

describe your issue

I ran the following on bash:

pre-commit run --config <(cat .pre-commit-config.yaml <(echo "fail_fast: true"))

I expected this to be valid since <() creates a temporary file descriptor on vfs and expose it normally on devfs as /dev/fd/<fd identifier> and cat will append to the created temporary file descriptor the configuration file and the fail_fast: true.

Although this is reproducible in bash, this bug can be expanded if anyone wants to pipe a file descriptor to a child process using procfs since devfs and procfs are both virtual file systems.

pre-commit --version

pre-commit 2.15.0

.pre-commit-config.yaml

# Pretty much any configuration
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 2.15.0
sys.version:
    3.9.7 (default, Aug 31 2021, 13:28:12) 
    [GCC 11.1.0]
sys.executable: /home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/env/bin/python3
os.name: posix
sys.platform: linux

error information

An error has occurred: InvalidConfigError: 
=====> ../../../../../../../../../dev/fd/63 is not a file
Traceback (most recent call last):
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/pre_commit/error_handler.py", line 65, in error_handler
    yield
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/pre_commit/main.py", line 400, in main
    return run(args.config, store, args)
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/pre_commit/commands/run.py", line 401, in run
    config = load_config(config_file)
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/env/lib/python3.9/site-packages/cfgv.py", line 411, in load_from_filename
    return apply_defaults(data, schema)
  File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/env/lib/python3.9/site-packages/cfgv.py", line 43, in reraise_as
    raise tp(e).with_traceback(tb) from None
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/env/lib/python3.9/site-packages/cfgv.py", line 40, in reraise_as
    yield
  File "/home/luis/Workspace/Programming/Repos/tempcollab/github/pre-commit/pre-commit/env/lib/python3.9/site-packages/cfgv.py", line 396, in load_from_filename
    raise ValidationError(f'{filename} is not a file')
pre_commit.clientlib.InvalidConfigError: 
=====> ../../../../../../../../../dev/fd/63 is not a file

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ljmf00commented, Oct 3, 2021

just use a normal file instead

This is not ideal. A user to use a temporary configuration file doesn’t need to use I/O or have tmpfs mounted. Writing to disk to read it right after is a workaround to how a UNIX-based system should work.

0reactions
asottilecommented, Oct 3, 2021

pre-commit needs a normal, writable file – a FIFO is not an acceptable substitute

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ | vfsglobal
Applicants should contact the Embassy of India or Consulate General of India directly to receive their original documents, once VFS returns the original ......
Read more >
Apache VFS Finds SFPT Server But Does Not Download File ...
I am trying to download a file in an sftp server via Apache VFS. The VFS finds the server itself, but it does...
Read more >
RW access to VFS in MSIX packages
Hi all, I need to give RW access to VFS in MSIX packages. ... IT doesnt look like Config file format issue else...
Read more >
Use the VFS storage driver - Docker Documentation
Configure Docker with the vfs storage driver​​ If it does not yet exist, create it. Assuming that the file was empty, add the...
Read more >
VFS Transport - WSO2 Enterprise Integrator 6.5.0
The Virtual File System (VFS) transport is used by WSO2 Enterprise Integrator(WSO2 EI) to process files in the specified source directory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found