1

I've read several similar topics where it is suggested to check/change permissions. And I already did this but it doesn't work.

Here is my project folder permissions:

$ stat trains
File: ‘trains’
Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: 816h/2070d  Inode: 265254      Links: 14
Access: (0777/drwxrwxrwx)  Uid: ( 1000/   xxx)   Gid: ( 1000/   xxx)
Access: 2016-07-19 08:24:43.633340992 +0300
Modify: 2016-07-19 08:20:59.785332645 +0300
Change: 2016-07-19 08:24:43.533340989 +0300
Birth: -

Last lines from my terminal log:

  Errno::EACCES - Permission denied @ rb_sysopen - /.byebug_history:
  byebug (9.0.5) lib/byebug/history.rb:39:in `save'
  byebug (9.0.5) lib/byebug/interface.rb:110:in `autosave'
  byebug (9.0.5) lib/byebug/processors/command_processor.rb:121:in `after_repl'
  byebug (9.0.5) lib/byebug/processors/command_processor.rb:100:in `process_commands'
  byebug (9.0.5) lib/byebug/processors/command_processor.rb:56:in `at_line'
  byebug (9.0.5) lib/byebug/context.rb:96:in `at_line'
  app/controllers/stations_controller.rb:13:in `new'

I tried to create /.byebug_history file myself with 777 permissions but it didn't help.

I have checked that error comes from .rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/byebug-9.0.5/lib/byebug/history.rb

from this part (if I comment it error disappears)

  open(Setting[:histfile], 'w') do |file|
    n_cmds.times { file.puts(pop) }
  end

I have already checked my other projects and created a new one from scratch and all of them throw the same error if I try to use byebug.

UPDATE

Just found out that it has something to do with my rails_server_helper script which I use to start server.

Here is the script

function r() {
  if [ "$1" = "st" ]; then
     if [ "$2" = "" ]; then
        RENV="development"
     else
        RENV="$2"
     fi
     r sp
     rails server -d -e "$RENV"
     tail -f log/development.log
     return 0
  elif [ "$1" = "sp" ]; then
     if [ -f tmp/pids/server.pid ]; then
        kill $2 $(cat tmp/pids/server.pid)
        return 0
     else
        echo "It seems there is no server running or you are not in a rails project root directory"
        return 1
     fi
  elif [ "$1" = "rt" ]; then
     r sp && r st $2
  else
 #    command rails $@
  echo "I don't know this command, dude..."
  fi;
}

And it is initializing in .bashrc like this:

if [ -f ~/@stuff/rails_server_helper.bash ]; then
    . ~/@stuff/rails_server_helper.bash
fi

So if I don't use it and start rails server normally with rails server command then Byebug permission error disappeares and I see Byebug debugging console where it should be. But I can't understand why.

Seybo Glaux
  • 787
  • 1
  • 7
  • 16

1 Answers1

2

Ok, found the answer. The reason is that this script starts rails server as a daemon:

rails server -d

For some reason debugging doesn't work in this case.

Seybo Glaux
  • 787
  • 1
  • 7
  • 16