Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordy transformations cause fx to crash with piped data #313

Open
plurry opened this issue May 13, 2024 · 3 comments
Open

Wordy transformations cause fx to crash with piped data #313

plurry opened this issue May 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@plurry
Copy link

plurry commented May 13, 2024

fx tries to open the first argument as a file even when the JSON data comes from stdin. This causes it to crash when a single transformation command is too long.

On my ext4 system, this:

echo "{}" | fx "x => {
    const thisVariableNameEatsUpPreciousCharacters = {
        hereAreMoreCharacters: '💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀'
    };

    return {...x, ...thisVariableNameEatsUpPreciousCharacters};
}"

crashes with this:

error: Uncaught (in promise) Error: ENAMETOOLONG: name too long, stat
  const stat = fs.statSync(path, {throwIfNoEntry: false})
                  ^
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:91:9)
    at __node_internal_uvException (ext:deno_node/internal/errors.ts:184:10)
    at denoErrorToNodeError (ext:deno_node/internal/errors.ts:1871:14)
    at Module.statSync (ext:deno_node/_fs/_fs_stat.ts:166:13)
    at isFile (file:///tmp/fx-34.0.0.js:275:19)
    at main (file:///tmp/fx-34.0.0.js:35:7)

I guess it can usually be worked around by splitting the commands up into multiple arguments, but it's still annoying.

@antonmedv antonmedv added the bug Something isn't working label May 13, 2024
@antonmedv
Copy link
Owner

This is a bug. Fx should check if file exists first.

@antonmedv
Copy link
Owner

On macos it works:

image

@antonmedv
Copy link
Owner

Got the error:

}'
    at Module.statSync (node:fs:1659:25)
    at isFile (/private/var/folders/2j/0x_1mj9j4tz5hzqghjckptj80000gn/T/fx-34.0.0.js:275:19)
    at main (/private/var/folders/2j/0x_1mj9j4tz5hzqghjckptj80000gn/T/fx-34.0.0.js:35:7) {
  errno: -63,
  code: 'ENAMETOOLONG',
  syscall: 'stat',
  path: 'x => {\n' +
    '    const thisVariableNameEatsUpPreciousCharacters = {\n' +
    "        hereAreMoreCharacters: '💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀💀dsasdfaskjdfhaskldjfhgaslkdjfhasdlkfjhasdlkfjhasdlfkjhasdflkjasdhflkjasdhflacnskdcfhalsdkfjhasldkfjhcasdlckfajhdsflbkasjdhfclnaskdjhfalskdfgjhsdflkfjhasdlfkahjsdflkasjhdflkafdggrhdfggsdfghsdghadfgsdfgsdfglhadshfglaksjdfhalskjdfhasldkfjhaldfkjhasdlfkjhasdflkjhadflkhasdlkfjhdfkhjasdlfkjhasdflkhaflkcansdfhvlkvajhfgvbalergtcqwaleifhavslbkfchasdblkfhldsfhasdfasfasdfdfdddddddadlakfjhas;dlkfa💀'\n" +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants