Skip to content
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

File.open("|/usr/bin/co ...") does not seem to work in Ruby 2.7 #9

Open
arpepper opened this issue May 4, 2023 · 2 comments
Open

Comments

@arpepper
Copy link

arpepper commented May 4, 2023

Sorry, I am not super familiar with git, and am even less familiar with
Ruby. But when upgrading from Ubuntu 18.04 to Ubuntu 20.04 Ruby
(going from 2.5 to 2.7) seemed to change enough
to break rcs-fast-export.rb

Making the following change seemed to work.

Adrian.

arpepper@u2004cvs2git:~/git/rcs-fast-export$ git diff
diff --git a/rcs-fast-export.rb b/rcs-fast-export.rb
index 4128335..62246a2 100755
--- a/rcs-fast-export.rb
+++ b/rcs-fast-export.rb
@@ -381,7 +381,8 @@ module RCS
        # TODO: what if a revision does not end with newline?
        # TODO this should be done internally, not piping out to RCS
        def RCS.expand_keywords(rcsfile, revision)
-               ret = ::File.read("|co -q -p#{revision} #{Shellwords.escape rcsfile}")
+               # ret = ::File.read("|/usr/bin/co -q -p#{revision} #{Shellwords.escape rcsfile}")
+               ret = ::IO.popen("/usr/bin/co -q -p#{revision} #{Shellwords.escape rcsfile}")
                lines = []
                ret.each_line do |line|
                        lines << line
arpepper@u2004cvs2git:~/git/rcs-fast-export$ 
@arpepper
Copy link
Author

arpepper commented May 4, 2023

Sorry, the markdown initally obfuscated my intended text comment. Eventually I deduced and remembered <pre>.

But this simple description of the change might still help.

Essentially, replace the line...
ret = ::File.read("|co -q -p#{revision} #{Shellwords.escape rcsfile}")

With...
ret = ::IO.popen("/usr/bin/co -q -p#{revision} #{Shellwords.escape rcsfile}")

@arpepper
Copy link
Author

arpepper commented May 8, 2023

I should have mentioned that the code only causes a problem if you specify "--expand-keywords" on your command line. So a work-around is to not use that option. (And users who do not use the option will not encounter the problem).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant