Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 7363039

Browse files
author
Antonio Scandurra
authored
Merge pull request #311 from atom/as/escalate-privileges-on-linux
Escalate privileges when writing to an unauthorized file also on Linux
2 parents 3b67cea + bd5a80e commit 7363039

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "text-buffer",
3-
"version": "13.15.3",
3+
"version": "13.15.4-0",
44
"description": "A container for large mutable strings with annotated regions",
55
"main": "./lib/text-buffer",
66
"scripts": {
@@ -48,7 +48,7 @@
4848
"diff": "^2.2.1",
4949
"emissary": "^1.0.0",
5050
"event-kit": "^2.4.0",
51-
"fs-admin": "^0.1.7",
51+
"fs-admin": "^0.5.0",
5252
"fs-plus": "^3.0.0",
5353
"grim": "^2.0.2",
5454
"mkdirp": "^0.5.1",

spec/text-buffer-io-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ describe('TextBuffer IO', () => {
448448
})
449449

450450
describe('when a permission error occurs', () => {
451-
if (process.platform !== 'darwin') return
451+
if (process.platform === 'win32') return
452452

453453
beforeEach(() => {
454454
const save = NativeTextBuffer.prototype.save

src/text-buffer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,8 @@ class TextBuffer {
19211921
try {
19221922
await this.buffer.save(destination, this.getEncoding())
19231923
} catch (error) {
1924-
if (error.code === 'EACCES' && destination === filePath && process.platform === 'darwin') {
1924+
const canEscalate = process.platform === 'darwin' || process.platform === 'linux'
1925+
if (error.code === 'EACCES' && destination === filePath && canEscalate) {
19251926
const fsAdmin = require('fs-admin')
19261927
try {
19271928
await this.buffer.save(fsAdmin.createWriteStream(filePath), this.getEncoding())

0 commit comments

Comments
 (0)