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

Diff between revision numbers displaying what looks like a linux binary #223

Closed
wlavallee opened this issue May 18, 2020 · 9 comments
Closed
Labels
bug Clear defects in the way ViewVC behaves

Comments

@wlavallee
Copy link

wlavallee commented May 18, 2020

Describe the bug
When selecting diff to the previous revision, the page that comes up looks like the binary dump of an executable.

Steps to reproduce the behavior

  1. Any file in the repository
  2. Click on Diff to previous X.XX

Expected behavior
Before we migrated to AWS Linux, it came up with an actual diff.

Additional context
Default AWS Linux install from epel:

$ yum list installed | grep -i view
viewvc.noarch 1.1.26-1.el7 @epel
viewvc-httpd-fcgi.noarch 1.1.26-1.el7 @epel

I went through the INSTALL file from viewvc-1.2.1, and the package seems to have done everything properly.

Here is my viewvc.conf file:

[general]
root_parents = /opt/cvs/ofc : cvs
address = Warren Lavallee <x@y>
[utilities]
rcs_dir = /bin/
svn = /bin/svn
diff = /bin/diff
cvsgraph = /bin/cvsgraph
[options]
root_as_url_component = 1
allowed_views = annotate, co, diff, markup, roots
binary_mime_types = application/octet-stream, image/*, application/pdf, application/vnd*, application/msword, audio/*
authorizer = forbidden
hide_cvsroot = 1
svn = /bin/svn
allow_compress = 1
template_dir = /usr/share/viewvc/templates
docroot = /viewvc-static
enable_syntax_coloration = 1
tabsize = 3
use_cvsgraph = 1
cvsgraph = /bin/cvsgraph
[templates]
diff = /bin/diff
[cvsdb]
[vhosts]
[authz-forbidden]
[authz-forbiddenre]
forbidden = cvslocks
[authz-svnauthz]
authzfile =
[query]
forbiddenre = 

There are no errors in the apache log file:

ssl_access_log:192.168.0.5 - warren [18/May/2020:08:39:10 -0400] "GET /viewvc/ofc/R1/wlthmgmt/common/feeds/xxx/inFeed_commands.sh?view=log HTTP/1.1" 200 22151
ssl_access_log:192.168.0.5 - warren [18/May/2020:08:39:12 -0400] "GET /viewvc/ofc/R1/wlthmgmt/common/feeds/xxx/inFeed_commands.sh?r1=1.10&r2=1.11 HTTP/1.1" 200 147943

I don't speak Python, but it looks to me like instead of launching a diff, it's actually including the contents of the diff binary?

Please help me out.
Screen Shot 2020-05-18 at 8 47 46 AM

Versions installed:
$ yum list installed | egrep -i 'rcs|diff|svc|pygmen|cvsgra|httpd'
cvsgraph.x86_64                     1.6.1-9.el7                      @epel
diffutils.x86_64                    3.3-5.amzn2                      installed
generic-logos-httpd.noarch          18.0.0-4.amzn2                   @amzn2-core
httpd.x86_64                        2.4.41-1.amzn2.0.1               @amzn2-core
httpd-devel.x86_64                  2.4.41-1.amzn2.0.1               @amzn2-core
httpd-filesystem.noarch             2.4.41-1.amzn2.0.1               @amzn2-core
httpd-manual.noarch                 2.4.41-1.amzn2.0.1               @amzn2-core
httpd-tools.x86_64                  2.4.41-1.amzn2.0.1               @amzn2-core
perl-Algorithm-Diff.noarch          1.1902-17.amzn2                  @amzn2-core
perl-Text-Diff.noarch               1.41-5.amzn2                     @amzn2-core
python-pygments.noarch              1.4-10.amzn2                     @amzn2-core
rcs.x86_64                          5.9.0-5.amzn2.0.2                @amzn2-core
viewvc-httpd-fcgi.noarch            1.1.26-1.el7                     @epel
$ python --version
Python 2.7.16

This is the apache config file that the epel package installed:

ScriptAlias /viewvc /usr/lib/python2.7/site-packages/viewvc/bin/wsgi/viewvc.fcgi
Alias /viewvc-static /usr/share/viewvc/templates/docroot

<Directory /usr/lib/python2.7/site-packages/viewvc/bin/wsgi>
    Options -Indexes

    <Files viewvc.fcgi>
        <IfModule mod_authz_core.c>
            # Apache 2.4
            Require local
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order allow,deny
            Allow from 127.0.0.1
            Allow from ::1
        </IfModule>
    </Files>
</Directory>
<Directory /usr/share/viewvc/templates/docroot>
    Options -Indexes
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require local
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from 127.0.0.1
        Allow from ::1
    </IfModule>
</Directory>
@wlavallee wlavallee added the bug Clear defects in the way ViewVC behaves label May 18, 2020
@cmpilato
Copy link
Contributor

That's certainly unexpected behavior!

Is that binary spew that you're seeing the entire output from ViewVC -- as in, it fills the whole browser window? Or does it appear embedded in an otherwise ViewVC-branded page?

@wlavallee
Copy link
Author

It's the entire page, all that's returned is a page that starts with that screenshot.
There is no branding, no header, no footer.

@wlavallee
Copy link
Author

A clue -- at the bottom of the page, however, is some python traceback:

L$/usr/share/localeinvalid context length '%s'-Dtoo many file label options^[[:alpha:]$_]-SLen TowerRichard StallmanDavid HayesMike HaertelPaul EggertGNU diffutilsdiffinvalid width '%s'conflicting width options--from-fileUsage: %s
An Exception Has Occurred

Python Traceback

Traceback (most recent call last):
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/viewvc.py&quot;, line 4855, in main
    request.run_viewvc()
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/viewvc.py&quot;, line 408, in run_viewvc
    self.view_func(self)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/viewvc.py&quot;, line 3640, in view_diff
    generate_page(request, &quot;diff&quot;, data)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/viewvc.py&quot;, line 954, in generate_page
    template.generate(server_fp, data)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/ezt.py&quot;, line 329, in generate
    self._execute(self.program, ctx)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/ezt.py&quot;, line 458, in _execute
    step[0](step[1], ctx)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/ezt.py&quot;, line 461, in _cmd_print
    value = _get_value(valrefs[0], ctx)
  File &quot;/usr/lib/python2.7/site-packages/viewvc/lib/ezt.py&quot;, line 620, in _get_value
    raise UnknownReference(refname)
UnknownReference: OPTION

@wlavallee
Copy link
Author

Is there some way to put viewvc in debug mode so I can see what it's actually doing? I can't find any log file other than the apache log file that just has the URL.

@cmpilato
Copy link
Contributor

Unfortunately, there's not much to offer as far as debugging goes.

The UnknownReference: OPTION error would occur if the ViewVC templates tried to reference a template variable called "option" that didn't exist. Are you using customized templates by any chance? We have a "cfg.options", but I'm not aware of any template data that has a the singular "option" name.

Is there any way you could try using the CGI mode of ViewVC to see if that helps? I haven't used the FastCGI method myself in many years, and I'm struggling a bit to get it working at all right now on my machine.

@wlavallee
Copy link
Author

I tried it with fcgi previously, wsgi, and cgi just now. wsgi failed the same way fcgi failed with the python traceback at the end. Cgi is doing the same thing, but there is no traceback at the end.

This was the wsgi config:

WSGIScriptAlias /viewvc /usr/lib/python2.7/site-packages/viewvc/bin/wsgi/viewvc.wsgi
Alias /viewvc-static /usr/share/viewvc/templates/docroot

<Directory /usr/lib/python2.7/site-packages/viewvc/bin/wsgi>
    Options -Indexes
    <Files viewvc.wsgi>
        <IfModule mod_authz_core.c>
            # Apache 2.4
            Require local
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order allow,deny
            Allow from 127.0.0.1
            Allow from ::1
        </IfModule>
    </Files>
</Directory>
<Directory /usr/share/viewvc/templates/docroot>
    Options -Indexes
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require local
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from 127.0.0.1
        Allow from ::1
    </IfModule>
</Directory>

This is the CGI config:

ScriptAlias /viewvc /usr/lib/python2.7/site-packages/viewvc/bin/cgi/viewvc.cgi
Alias /viewvc-static /usr/share/viewvc/templates/docroot

<Directory /usr/lib/python2.7/site-packages/viewvc/bin/cgi>
    Options -Indexes +ExecCGI
    AddHandler cgi-script .cgi .pl

    <Files viewvc.cgi>
        <IfModule mod_authz_core.c>
            # Apache 2.4
            Require local
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order allow,deny
            Allow from 127.0.0.1
            Allow from ::1
        </IfModule>
    </Files>
</Directory>
<Directory /usr/share/viewvc/templates/docroot>
    Options -Indexes
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require local
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from 127.0.0.1
        Allow from ::1
    </IfModule>
</Directory>

No customization, this is a virgin EPEL repository install, with modifications to the viewvc.conf file to point to our data.

Is there any way I can get logs to see whats happening?

@futatuki
Copy link
Collaborator

[templates]
diff = /bin/diff

I think this is the cause.
In template section, diff option is not for specifying external command to make diff output, but for specifying alternative template for diff view.

@wlavallee
Copy link
Author

@futatuki That did it, you're the best! Working as normal now. Thanks!
Please find attached a thank you photo -- sunrise in Worcester on May 3rd, 2020:
DJI_0773_AuroraHDR2019-edit Panorama-2

@cmpilato
Copy link
Contributor

@futatuki Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Clear defects in the way ViewVC behaves
Projects
None yet
Development

No branches or pull requests

3 participants