Bug #4235: svn keywords in code prevent correct building of ruby using git mirror
http://redmine.ruby-lang.org/issues/show/4235

Author: Stephen Bannasch
Status: Open, Priority: Normal
Category: build
ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]

Right now there are 355 locations in C and Ruby source files where Subversion keywords are used. 

  $ ack -l '\$(Date|Revision|Author|HeadURL|Id)\$' --nohtml | wc -l
     355

Almost all of these uses are in comments in source files.

However there are a number of places that $Id$ and $Revision$ are used in runnable code.

This means that correct Ruby builds can't be made using the official git mirror: https://github.com/ruby/ruby

The usage breaks down as follows:

  $ ack -l '\$(Date)\$' --nohtml | wc -l
         1
  $ ack -l '\$(Revision)\$' --nohtml | wc -l
        58
  $ ack -l '\$(Author)\$' --nohtml | wc -l
       113
  $ ack -l '\$(HeadURL)\$' --nohtml | wc -l
         0
  $ ack -l '\$(Id)\$' --nohtml | wc -l
       212

The most useful first step would be to remove the use of subversion keywords from the runnable code. 

Here are the locations I found usage of svn keywords in runnable code in trunk. This is done in teh trunk branch from a git clone of the official mirror: https://github.com/ruby/ruby

I used the following regexes with ack to at least exclude usage in ruby commenetd code that starts with '#':

  ack '^[^#].*\$Id\$' --nohtml --heading --break -C 6 
  ack '^[^#].*\$Revision\$' --nohtml --heading --break -C 6 

http.rb, pop.rb, and smtp.rb:

  class HTTP < Protocol

    # :stopdoc:
    Revision = %q$Revision$.split[1]
    HTTPVersion = '1.1'

rexml.rb:

  REVISION = %w$Revision$[1] || ''

ruby-mode-el and ruby-style.el:

  (defconst ruby-mode-revision "$Revision$"
    "Ruby mode revision string.")

in lib/irb: cmd/fork.rb, cmd/nop.rb, completion.rb, ext/history.rb, ext/loader.rb,
ext/multi-irb.rb, ext/save-history.rb, input-method.rb, locale.rb, output-method.rb,
ruby-lex.rb, slex.rb, xmp.rb and irb.rb itself:

  @RCS_ID='-$Id$-'

lib/logger.rb

  _, name, rev = %w$Id$

lib/optparse.rb

  RCSID = %w$Id$[1..-1].each {|s| s.freeze}.freeze

lib/sync.rb

  RCS_ID='-$Id$-'

lib/net/telnet.rb

  REVISION = '$Id$'

lib/cgi/core.rb

  REVISION = '$Id$' #:nodoc:

ext/strscan/strscan.c

  tmp = rb_str_new2("$Id$");

There are some places where $Id$ is used in code buit the code itself is commented out:

ext/sdbm/_sdbm.c

  #ifndef lint
  /*char sdbm_rcsid[] = "$Id$";*/
  #endif

and:

  #ifndef lint
  /*char pair_rcsid[] = "$Id$";*/
  #endif

----------------

Here's a summary of some of the ways svn keywords are used now in comments in code:

Ruby source:

  #   fork.rb -
  #   	$Release Version: 0.9.6 $
  #   	$Revision$
  #   	by Keiju ISHITSUKA(keiju / ruby-lang.org)

or a C header:

  /**********************************************************************

    rubysig.h -

    $Author$
    $Date$
    created at: Wed Aug 16 01:15:38 JST 1995

    Copyright (C) 1993-2008 Yukihiro Matsumoto

  **********************************************************************/

Or an emacs script (misc/inf-ruby.el):

  ;;; -*-Emacs-Lisp-*-
  ;;;
  ;;;  $Id$
  ;;;  $Author$

Or block comments using =begin (lib/xmlrpc/datetime.rb):

  =begin
  = History
      $Id$
  =end


----------------------------------------
http://redmine.ruby-lang.org