-
Notifications
You must be signed in to change notification settings - Fork 52
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
Preprocessor writes to file (or fails to) #4
Comments
Looks to me like it should be writing to the temp directory (it's doing Are you not seeing this? |
$ irb
1.9.3p286 :001 > require 'cast'
=> true
1.9.3p286 :002 > C::Preprocessor.new.preprocess_file('/usr/include/math.h')
Errno::ENOENT: No such file or directory - /usr/include/cast-preprocessor-input.20140218-12133-xon498.c.lock
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:346:in `rmdir'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:346:in `rmdir'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:338:in `ensure in locking'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:338:in `locking'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:144:in `block in initialize'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tmpdir.rb:133:in `create'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:134:in `initialize'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:316:in `new'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/tempfile.rb:316:in `open'
from /Users/ghazel/.rvm/gems/ruby-1.9.3-p286/gems/cast-0.2.1/lib/cast/preprocessor.rb:30:in `preprocess'
from /Users/ghazel/.rvm/gems/ruby-1.9.3-p286/gems/cast-0.2.1/lib/cast/preprocessor.rb:45:in `block in preprocess_file'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/fileutils.rb:125:in `chdir'
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/fileutils.rb:125:in `cd'
from /Users/ghazel/.rvm/gems/ruby-1.9.3-p286/gems/cast-0.2.1/lib/cast/preprocessor.rb:44:in `preprocess_file'
from (irb):2
from /Users/ghazel/.rvm/rubies/ruby-1.9.3-p286/bin/irb:16:in `<main>'
1.9.3p286 :003 > |
Ah - got it. Yeah that seems reasonable. |
byteit101
added a commit
to byteit101/cast
that referenced
this issue
Oct 1, 2022
1. Don't delete the preprocessor file before running cpp 2. Use the system temp dir, not the location (Fixes oggy#4)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The C::Preprocessor attempts to write a temp file in the directory where the input file is. This is problematic for system includes where the user does not have permission to write. (i.e.
C::Preprocessor.new.preprocess_file('/usr/include/math.h')
) Yes,pwd
can be set manually, but I can't help thinking it would be better to just send the input data to the compiler over stdin.That is, if the Preprocessor isn't going to be entirely replaced with ruby code.
The text was updated successfully, but these errors were encountered: