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.

17.3.0 introduces a regression for handling quoted string

See original GitHub issue

Hello,

When upgrading my dependancies to their latest versions on a branch, I detected a regression in yargs (that wasn’t present in 17.2.1).

image

I created the following diff command in my project :

    diff [files..]
    
    Compare at least two i18n files & generate a report
    
    Options :
      --version             Affiche le numéro de version                   [booléen]
      --help                Affiche l'aide                                 [booléen]
      --filename, --of      Name of the output file generated by this CLI (without
                            extension)
                                  [chaîne de caractères] [défaut : (valeur générée)]
      --outputDir, --od     Output folder where to store the output file
                         [chaîne de caractères] [défaut : "D:\workspace\i18n-tools"]
      --keySeparator, --ks  Char to separate i18n keys. If working with flat JSON,
                            set this to false  [chaîne de caractères] [défaut : "."]
      --outputFormat        Output format         [choix : "JSON"] [défaut : "JSON"]
      --operations          Array of operations (such as ["ADD", "PUT"]) that should
                            be checked when comparing files
                                            [tableau] [défaut : ["DEL","ADD","PUT"]]
      --settings            Chemin du fichier de configuration JSON

When running this command on Windows in my diff.test.ts in test “JSON reporter - Inline paths should be accepted” :

diff --filename "diff_inline-JSON" --outputDir "D:\\\\TEMP\\\\TEMP" "D:\\\\TEMP\\\\TEMP\\\\tests-for-diff\\\\correct\\\\file1.json" "D:\\\\TEMP\\\\TEMP\\\\tests-for-diff\\\\correct\\\\file1.json"

I got the following stacktrace :

  console.error
    index.js diff [files..]
    
    Compare at least two i18n files & generate a report
    
    Options :
      --version             Affiche le numéro de version                   [booléen]
      --help                Affiche l'aide                                 [booléen]
      --filename, --of      Name of the output file generated by this CLI (without  
                            extension)
                                  [chaîne de caractères] [défaut : (valeur générée)]
      --outputDir, --od     Output folder where to store the output file
                         [chaîne de caractères] [défaut : "D:\workspace\i18n-tools"]
      --keySeparator, --ks  Char to separate i18n keys. If working with flat JSON,
                            set this to false  [chaîne de caractères] [défaut : "."]
      --outputFormat        Output format         [choix : "JSON"] [défaut : "JSON"]
      --operations          Array of operations (such as ["ADD", "PUT"]) that should
                            be checked when comparing files
                                            [tableau] [défaut : ["DEL","ADD","PUT"]]
      --settings            Chemin du fichier de configuration JSON

      at error (node_modules/yargs/build/index.cjs:1:43554)
      at Object.showHelp (node_modules/yargs/build/index.cjs:1:19441)
      at Jt.showHelp (node_modules/yargs/build/index.cjs:1:40813)
      at Object.fail (node_modules/yargs/build/index.cjs:1:13247)
      at node_modules/yargs/build/index.cjs:1:9269

  console.error
    undefined

      at Object.error (node_modules/yargs/build/index.cjs:1:43554)
      at Object.fail (node_modules/yargs/build/index.cjs:1:13267)
      at node_modules/yargs/build/index.cjs:1:9269

  console.error
    [Error: ENOENT: no such file or directory, open 'D:\workspace\i18n-tools\"D:\TEMP\TEMP\tests-for-diff\correct\file1.json"'] {
      errno: -4058,
      code: 'ENOENT',
      syscall: 'open',
      path: 'D:\\workspace\\i18n-tools\\"D:\\TEMP\\TEMP\\tests-for-diff\\correct\\file1.json"'
    }

      at Object.error (node_modules/yargs/build/index.cjs:1:43554)
      at Object.fail (node_modules/yargs/build/index.cjs:1:13286)
      at node_modules/yargs/build/index.cjs:1:9269

  ●  process.exit called with "1"

      at Object.exit (node_modules/yargs/build/index.cjs:1:58603)
      at Jt.exit (node_modules/yargs/build/index.cjs:1:33445)
      at Object.fail (node_modules/yargs/build/index.cjs:1:13377)
      at node_modules/yargs/build/index.cjs:1:9269

As you can see :

  • D:\workspace\i18n-tools\"D:\TEMP\TEMP\tests-for-diff\correct\file1.json seems to be a weird concatenation of two things :
  • "D:\workspace\i18n-tools" : the cwd
  • “D:\TEMP\TEMP\tests-for-diff\correct\file1.json” : the path I provided

Thanks in advance

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jly36963commented, Dec 29, 2021

@bcoe I want to do some digging to make sure that my fix has no unintended side-effects. I’ll let you know when I’ve finished investigating.

1reaction
jy95commented, Dec 27, 2021

Sure, take your time 😉 For info, I removed some quotes in my code so that I can finally merge that PR. To reproduce the bug on that branch, please refer to the commit with SHA 1acb97c21175e7e38bd2bbd21d028a07ddcce58a

Read more comments on GitHub >

github_iconTop Results From Across the Web

tox fails when running in a path containing a hash #763 - GitHub
Path objects) to handle quoted paths, as it interprets the quotes as literals. Fun fact. [testenv:hashpath] commands = echo {envdir}.
Read more >
GroupDocs.Conversion for Java 17.3.0 Release Notes
Helper method to return pages count of a document which will be converted; Improved progress reporting; Improved performance of Word to Pdf and...
Read more >
java.awt.HeadlessException thrown when converting HTML to ...
Updating to Aspose PDF for Java 17.3.0 and higher throws an exception while trying to convert an HTML file to PDF under headless...
Read more >
Untitled
Tv serial wallpaper star plus, Green party conference ireland, Dealing with dumb people quotes, Wailupe district park, David northington piano, Hlm training ...
Read more >
Introduce the ability to roll back a Visual Studio Update
Rolling back an SDK therefore is an uninstall and re-install, and take a long time, and are almost invariably, not the cause of...
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