FS#70668 - [code] retry as sudo fix

Attached to Project: Community Packages
Opened by FederAndInk (FederAndInk) - Friday, 30 April 2021, 23:28 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Friday, 28 April 2023, 14:15 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Massimiliano Torromeo (mtorromeo)
Filipe Laíns (FFY00)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
I've seen https://bugs.archlinux.org/task/61516#close
I found a solution (and a sed command that should be updated in the PKGBUILD)

Additional info:
* package version(s)
1.55.2
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
first here is the updated sed command:
```
diff --git a/repos/community-x86_64/PKGBUILD b/repos/community-x86_64/PKGBUILD
index 769ac2c7..353a2399 100644
--- a/repos/community-x86_64/PKGBUILD
+++ b/repos/community-x86_64/PKGBUILD
@@ -92,9 +92,9 @@ prepare() {
sed -i 's|@@APPNAME@@|code-oss|g' resources/completions/{bash/code-oss,zsh/_code-oss}

# Fix bin path
- sed -i "s|return path.join(path.dirname(execPath), 'bin', \`\${product.applicationName}\`);|return '/usr/bin/code';|g
- s|return path.join(appRoot, 'scripts', 'code-cli.sh');|return '/usr/bin/code';|g" \
- src/vs/platform/environment/node/environmentService.ts
+ sed -i "s|return join(dirname(process.execPath), 'bin', \`\${this.productService.applicationName}\`);|return '/usr/bin/code';|g
+ s|return join(this.environmentMainService.appRoot, 'scripts', 'code-cli.sh');|return '/usr/bin/code';|g" \
+ src/vs/platform/native/electron-main/nativeHostMainService.ts
}

build() {
```

Then, in src/vs/code/node/cli.ts drop the argument 0 because args._[0] is '/usr/lib/code/code.js'.

```
diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
index c1285622ed0..46d9f1b7698 100644
--- a/src/vs/code/node/cli.ts
+++ b/src/vs/code/node/cli.ts
@@ -63,8 +63,8 @@ export async function main(argv: string[]): Promise<any> {

// Write File
else if (args['file-write']) {
- const source = args._[0];
- const target = args._[1];
+ const source = args._[1];
+ const target = args._[2];

// Validate
if (
```

It's a workaround but at least it works, you surely have a better idea on how to remove this first argument,
I saw that it's done in /usr/lib/code/code.js but in /usr/bin/code-oss cli.js seems to be called before,
I don't really know how all the pieces come together.

I Hope this will help
This task depends upon

Closed by  Massimiliano Torromeo (mtorromeo)
Friday, 28 April 2023, 14:15 GMT
Reason for closing:  Fixed
Additional comments about closing:  code-1.77.3-2

Loading...