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

Error executing 'reg': Access is denied. (os error 5) #8245

Closed
cderv opened this issue Jan 12, 2024 · 12 comments · Fixed by #8270
Closed

Error executing 'reg': Access is denied. (os error 5) #8245

cderv opened this issue Jan 12, 2024 · 12 comments · Fixed by #8270
Assignees
Labels
bug Something isn't working windows
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jan 12, 2024

here is my output when i ran the quarto check, the errors in the quarto.js files displayed below are also what appears when i try to render a sample quarto document.

Test.User@PHX-111 MINGW64 ~/Desktop/Brain2/R/quatro1/test2
$ quarto check
Quarto 1.4.539
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.4.539
      Path: C:\Users\Test.User\AppData\Local\Programs\Quarto\bin
      CodePage: unknown

error: Uncaught (in promise) Error: Error executing 'reg': Access is denied. (os error 5)
        throw new Error(`Error executing '${options.cmd[0]}': ${e.message}`);
              ^
    at execProcess (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:5295:15)
    at registryReadString (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:26513:27)
    at registryReadString (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:26498:31)
    at cacheCodePage (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:39487:29)
    at readCodePage (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:39520:13)
    at checkInstall (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:98441:30)
    at check (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:98384:19)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async Command.fn (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:98667:5)
    at async Command.execute (file:///C:/Users/Test.User/AppData/Local/Programs/Quarto/bin/quarto.js:8102:13)

Originally posted by @serrulate in #5104 (comment)

@cderv
Copy link
Collaborator Author

cderv commented Jan 12, 2024

@serrulate I opened a new issue because it was different than #5104

From the trace, this error is thrown from

} catch (e) {
throw new Error(`Error executing '${options.cmd[0]}': ${e.message}`);
}

This is an error while trying to read from the registry at

const value = await registryReadString(
[kHKeyLocalMachine, kHKeyCurrentUser],
"SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage",
"ACP",
);

We are supposed to call reg

const cmd = [
"reg",
"query",
`${root}\\${key}`,
"/v",
value,
];

Can you open a CMD window and try the following

reg query HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP

reg query HKCU\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP

thank you

@cderv cderv self-assigned this Jan 12, 2024
@cderv cderv added bug Something isn't working windows labels Jan 12, 2024
@serrulate
Copy link

Thank you for working with me on this, i will need to get help from an Admin locally to run the command, i get an access denied message when i try to run the command.

U:>reg query HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP
Access is denied.

@cderv
Copy link
Collaborator Author

cderv commented Jan 12, 2024

I will need to get help from an Admin locally to run the command, I get an access denied message when I try to run the command.

This is exactly the issue you encounter with Quarto. We did not protect against this.

@dragonstyle can we work with an unknown codepage if we have an error like this from the registry reading?

According to our code, I think we can use a try-catch here

export async function cacheCodePage() {
if (!existsSync(tokenPath)) {
const value = await registryReadString(
[kHKeyLocalMachine, kHKeyCurrentUser],
"SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage",
"ACP",
);
if (value) {
Deno.writeTextFileSync(tokenPath, value);
}
}
}

What do you think?

@dragonstyle
Copy link
Collaborator

I would be in favor of adding a try/catch in registryReadString so access denied to HKLM won't prevent us from trying to read HKCU.

@serrulate
Copy link

is there a way i could try these modifications, or is something that i would need to wait for the next release?

@mcanouil
Copy link
Collaborator

It should be part of 1.4.453

@cderv
Copy link
Collaborator Author

cderv commented Jan 15, 2024

And you can download current Release Candidate at: https://quarto.org/docs/get-started/

@serrulate
Copy link

serrulate commented Jan 15, 2024 via email

@mcanouil
Copy link
Collaborator

It's already available, but it's a release candidate which means soonish there will be a 1.4 stable release.

@cderv
Copy link
Collaborator Author

cderv commented Jan 15, 2024

@serrulate we show the version number in the page I linked
image

It happens that we are in release candidate phase, so this is the main download option

Latest pre-release of quarto is also always available at: https://quarto.org/docs/download/prerelease.html

@serrulate
Copy link

I wanted to confirm that after downloading the 1.4.543 candidate and installing a machine that i do now have admin rights on i i was able to successfully render a quarto document. Thank you!!!!

@mcanouil
Copy link
Collaborator

Thanks for letting us know.

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

Successfully merging a pull request may close this issue.

4 participants