node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

"Permission denied" issue still happening with gh 2.7.0 #738

Closed brandizzi closed 4 years ago

brandizzi commented 4 years ago

Version number 2.7.0

Describe the bug I installed gh globally and when I try to send a pull request, it fails to open a temporary file. It is very similar to #717, I guess, but it happens on 2.7.0

To Reproduce Steps to reproduce the behavior:

  1. Install node gh globally with sudo npm install -g gh
  2. Send a pulll request to someone with the command gh pr -s <githubname>

Expected behavior

A pull request is created

**Actual behavior.

I got this error

$ gh pr -s me 
Submitting pull request to @brandizzi
/bin/sh: 1: /tmp/tmp-7698I4J0txD6Cw9o-temp-gh-pr-title.txt: Permission denied
fatal: Could not use your editor to store a custom message
 { Error: Command failed:  "/tmp/tmp-7698I4J0txD6Cw9o-temp-gh-pr-title.txt"
    at checkExecSyncError (child_process.js:629:11)
    at Object.execSync (child_process.js:666:13)
    at Object.execSyncInteractiveStream (/usr/local/lib/node_modules/gh/lib/exec.js:58:25)
    at Object.openFileInEditor (/usr/local/lib/node_modules/gh/lib/utils.js:74:16)
    at submit (/usr/local/lib/node_modules/gh/lib/cmds/pull-request/submit.js:22:25)
    at Object.submitHandler (/usr/local/lib/node_modules/gh/lib/cmds/pull-request/submit.js:50:26)
  status: 126,
  signal: null,
  output: [ null, null, null ],
  pid: 7771,
  stdout: null,
  stderr: null }

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I am using Ubuntu 18.04

Some temp files are created at /tmp, these are their permissions:

-rw------- 1 adam adam 122 nov 11 15:13 /tmp/tmp-6671S2t1flHwBQby-temp-gh-pr-title.txt
-rw------- 1 adam adam 122 nov 11 15:21 /tmp/tmp-700351HD3BImosWu-temp-gh-pr-title.txt
-rw------- 1 adam adam 122 nov 11 15:23 /tmp/tmp-7698I4J0txD6Cw9o-temp-gh-pr-title.txt

adam is my username here.

More about gh in my machine:

$ which gh
/usr/local/bin/gh
$ gh --version
gh 2.7.0
protoEvangelion commented 4 years ago

@brandizzi as a short term solution you could do:

gh pr -s brandizzi -b master -t "title" -D "description"
protoEvangelion commented 4 years ago

Long term I need to find a better way to fallback if the user's OS temp dir is not writable.

Maybe I could check if it is not writable and fallback to the last commit message for the title and just leave the description blank.

Any thoughts?

brandizzi commented 4 years ago

Hey Ryan! Just saw our answer today. I will try this out. Thank you!

Em sex., 15 de nov. de 2019 às 19:07, Ryan Garant notifications@github.com escreveu:

Closed #738 https://github.com/node-gh/gh/issues/738.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/node-gh/gh/issues/738?email_source=notifications&email_token=AABGDID2QI6SH2I6OQCZ5O3QT4MSTA5CNFSM4JLZIVXKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOU4RZETQ#event-2804126286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABGDIEW6B4J242X367G5Z3QT4MSTANCNFSM4JLZIVXA .

-- Adam Victor Nazareth Brandizzi http://adam.brandizzi.com.br/