noseglid / atom-build

:hammer: Build your project directly from the Atom editor
https://atom.io/packages/build
MIT License
248 stars 97 forks source link

Uncaught Error: EACCES: permission denied, open '~/Application/Applications/Arduino_Relay' #506

Closed k5avl closed 7 years ago

k5avl commented 7 years ago

[Enter steps to reproduce:]

  1. New Project
  2. Copied Arduino program from website, typed 'sudo nano file name pasted Arduino program into file saved file options "Save and build" "Build Without Saving" I chose "Save and build"
  3. Uncaught Error: EACCES: permission denied. ope/home/gar/Application/Applications/Arduino_Relay'n

Atom: 1.15.0 x64 Electron: 1.3.13 OS: Debian GNU/Linux Thrown From: build package 0.67.0

/*

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. / / Hack.lenotta.com Modified code of Getting Started RF24 Library It will switch a relay on if receive a message with text 1, turn it off otherwise. Edo */

include

include "nRF24L01.h"

include "RF24.h"

include "printf.h"

int relay = 1;

// // Hardware conf //

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(9,10);

// // Topology //

// Radio pipe addresses for the 2 nodes to communicate. const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

char * convertNumberIntoArray(unsigned short number, unsigned short length) {

char * arr = (char *) malloc(length * sizeof(char)), * curr = arr;
do {
    *curr++ = number % 10;
  number /= 10;
} while (number != 0);
return arr;

}

unsigned short getId(char rawMessage, unsigned short length){ unsigned short i = 0; unsigned short id = 0; for( i=1; i< length; i++){ id += rawMessage[i]pow( 10, i-1 ); } return id; }

unsigned short getMessage( char * rawMessage){ unsigned short message = rawMessage[0]; return (unsigned short)message; } unsigned short getLength( unsigned int rudeMessage){ unsigned short length = (unsigned short)(log10((float)rudeMessage)) + 1; return length; }

void setup(void) { // // Print preamble //

Serial.begin(57600); pinMode(relay, OUTPUT); digitalWrite(relay, HIGH); printf_begin(); printf("\nRemote Switch Arduino\n\r");

// // Setup and configure rf radio //

radio.begin(); // radio.setAutoAck(1); // Ensure autoACK is enabled radio.setRetries(15,15);

radio.openWritingPipe(pipes[1]); radio.openReadingPipe(1,pipes[0]); radio.startListening(); radio.printDetails(); }

int getState(unsigned short pin){ boolean state = digitalRead(pin); return state == true ? 0 : 1; }

void doAction(unsigned short id, unsigned short action){

if( action == 0 ){
    digitalWrite(id, HIGH);
}else{
    digitalWrite(id, LOW);
}

} void sendCallback(unsigned short callback){ // First, stop listening so we can talk radio.stopListening();

  // Send the final one back.
  radio.write( &callback, sizeof(unsigned short) );
  printf("Sent response.\n\r");

  // Now, resume listening so we catch the next packets.
  radio.startListening();

}

void performAction(unsigned short rawMessage){ unsigned short action, id, length, callback; char * castedMessage;

length = getLength(rawMessage); castedMessage = convertNumberIntoArray(rawMessage, length); action = getMessage(castedMessage); id = getId(castedMessage, length);

if (action == 0 || action ==1){ callback = action; doAction(id, action); }else if(action == 2){ callback = getState(id); } sendCallback(callback);

} void loop(void) {

// if there is data ready
if ( radio.available() )
{
  // Dump the payloads until we've gotten everything
  unsigned short message;
  bool done;

// char * new; unsigned short rawMessage; done = false; while ( radio.available() ) { // Fetch the payload, and see if this was the last one. radio.read( &rawMessage, sizeof(unsigned long) );

    // Spew it
    printf("Got message %d...",rawMessage);

    performAction(rawMessage);

    delay(10);
  }

}

}

Stack Trace

Uncaught Error: EACCES: permission denied, open '/home/gar/Application/Applications/Arduino_Relay'

At /usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1076

Error: EACCES: permission denied, open '/home/gar/Application/Applications/Arduino_Relay'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:168:20)
    at Object.fs.writeFileSync (fs.js:1343:33)
    at Object.writeFileSync (/app.asar/node_modules/fs-plus/lib/fs-plus.js:281:17)
    at File.module.exports.File.writeFileSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:285:19)
    at File.module.exports.File.writeFileWithPrivilegeEscalationSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:463:21)
    at File.module.exports.File.writeSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:380:12)
    at TextBuffer.module.exports.TextBuffer.saveAs (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1067:19)
    at TextBuffer.module.exports.TextBuffer.save (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1048:19)
    at TextEditor.module.exports.TextEditor.save (/app.asar/src/text-editor.js:915:26)
    at /packages/build/lib/build.js:276:70
    at Array.forEach (native)
    at /packages/build/lib/build.js:276:27)
    at SaveConfirmView.saveAndConfirm (/packages/build/lib/save-confirm-view.js:47:12)
    at /packages/build/node_modules/space-pen/lib/space-pen.js:220:36)
    at HTMLButtonElement.dispatch (/packages/build/node_modules/jquery/dist/jquery.js:4435:9)
    at HTMLButtonElement.elemData.handle (/packages/build/node_modules/jquery/dist/jquery.js:4121:28)

Commands

 40x -6:04.8.0 core:backspace (input.hidden-input)
     -5:37.4.0 core:paste (div.lines)
 19x -5:33 core:page-up (input.hidden-input)
 19x -5:21.5.0 core:move-down (input.hidden-input)
 11x -5:16.6.0 core:move-right (input.hidden-input)
     -5:13.9.0 core:delete (input.hidden-input)
     -5:06.3.0 core:page-down (input.hidden-input)
     -4:51.3.0 platformio-ide:target:build (input.hidden-input)
     -4:51.3.0 platformio-ide:target:build-/home/gar/Application (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-ui.theme-atom-dark-syntax.find-visible)
 36x -3:05.3.0 core:move-up (input.hidden-input)
undefined -1:12.7.0 core:select-down (input.hidden-input)
     -1:02.0 core:delete (input.hidden-input)
     -0:59.2.0 core:backspace (input.hidden-input)
     -0:38.6.0 core:delete (input.hidden-input)
     -0:34.1.0 platformio-ide:target:build (input.hidden-input)
     -0:34.1.0 platformio-ide:target:build-/home/gar/Application (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-ui.theme-atom-dark-syntax.find-visible)

Non-Core Packages

autocomplete-clang 0.10.0 
build 0.67.0 
busy 0.7.0 
busy-signal 1.3.0 
file-icons 2.0.17 
intentions 1.1.2 
language-ini 1.19.0 
linter 2.1.0 
linter-gcc 0.7.1 
linter-ui-default 1.2.1 
minimap 4.26.8 
platformio-ide 2.0.0-alpha.12 
platformio-ide-terminal 2.5.0 
tool-bar 1.1.0 
noseglid commented 7 years ago

Without knowing too much about the Arduino build process, it looks like you're writing and saving a file as a super user (sudo), then trying to alter it with Atom. At this point it seems as you do not have write permissions. Make sure you have correct permissions on the ~/Application/Applications/Arduino_Relay folder.