Unable to see the contents of the files for git repo (Error:Can't locate object method "getline" via package "IO::Handle" at ..../LXR/Files/GIT.pm line 217

Help
2014-01-27
2014-03-11
  • vinay kambam
    vinay kambam
    2014-01-27

    Hi,

    I'm unable to see the contents of the files,getting error

    Can't locate object method "getline" via package "IO::Handle" at ..../LXR/Files/GIT.pm line 217

    The source for the cross reference is a GIT repo.I'm able to see the folders but not contents.

    source root in the lxr.conf is as

    'sourceroot' => 'git:/home/vinay/bs2/bs2/.git' ,my git repo is at /home/vinay/bs2/bs2

    Any help in this issue is most welcome and appreciated

    Thanks in advance
    Vinay

     
  • Andre-Littoz
    Andre-Littoz
    2014-01-27

    Hi,
    Can you be more specific? Does this error occur during genxref processing or when browsing your tree?
    Can you see directory listing? Does this occur when you try to display a file?
    Have you checked that your local git repo is OK? If you can display a directory, it is OK.

    From your message above, 'sourceroot' definition looks right but the issue may lie in other parameters. Please send your lxr.conf. If you do not want to publicly release your conf file, send it as attached file to ajlittoz (at) users (dot) sourceforge (dot) net [replace (...) with the corresponding character without surrounding spaces -- that's meant to protect my @dress from spybots].

    Regards,
    ajl

     
  • vinay kambam
    vinay kambam
    2014-01-28

    Hi ajl,

    Thanks for the quick reply :)

    Yes,I got this error while browsing the tree,Indexing was not a problem.

    I can browse through all the files and directories,but when I try to see the contents of the file I'm facing this error.

    I don't think there is problem with my repo as I'm able to work with my repo.

    I will send my configuration file.

    Thanks,
    Vinay

     
  • Andre-Littoz
    Andre-Littoz
    2014-02-01

    Hi,

    Could you try the following command after you cd to your LXR root directory:

    git --git-dir=/home/xvinkam/bs_gen2/bs_g2/.git blame -tc HEAD -- filename
    

    where filename is relative to your tree root (this is not an absolute path starting with /home/...). Do it on a short file or pipe the output to more.

    This command is internally used to gain access to the file text.
    If it fails, you later get the "can't locate method getline at line 217".

    I didn't ask about LXR release number. Is it 2.0.0 or 1.2.0?

    Regards,
    ajl

     
  • vinay kambam
    vinay kambam
    2014-02-03

    Hi ajl,

    I'm using LXR 2.0.0 version

    I tried with the command you have mentioned...

    I got the error something like this

    /home/xvinkam/lxr/lxr_git/lxr_test_repo/lxr>git --git-dir=/home/xvinkam/bs_gen2/bs_g2/.git blame -tc master -- ../../../../bs_gen2/bs_g2/env.bash

    fatal: '../../../../bs_gen2/bs_g2/env.bash' is outside repository

    but the same command when I gave at /home/xvinkam/bs_gen2/bs_g2 gives the result.

    git blame -tc master -- env.bash

    /home/xvinkam/bs_gen2/bs_g2>git blame master -- env.bash

    Is there anything wrong with my repo ?

    If not so ,Please try to give some workaround to this problem

    Thanks,
    Vinay

     
  • Andre-Littoz
    Andre-Littoz
    2014-02-03

    I don't quite understand. Do you get file content through

    git blame master -- env.bash
    

    with git revision hash number, commit author, ... ?

    Note that --git-dir is only necessary when git can't figure out by itself the repository location, which is the case under LXR

    If you display correctly the file with update information, your git repo is OK. But I see from your copy that you probably cd'ed to the git repo directory.

    LXR senses the git repo from another working directory. Consequently, option --git-dir is mandatory. Try once again

    git --git-dir=/home/xvinkam/bs_gen2/bs_g2/.git blame -tc master -- env.bash
    

    from any current directory but the git repo one (because the command is likely to always succeed from this directory).

    This will confirm correct git configuration.

     
  • vinay kambam
    vinay kambam
    2014-02-04

    Hi,

    I have checked that command , I got the result as expected (with commit id, author ...)

    In my previous update I gave the wrong path to file(I gave relative path to the file from current directory),so I faced that error.

    Now,it means that the problem is not with the repo.

     
  • Andre-Littoz
    Andre-Littoz
    2014-02-05

    Hi,

    I checked the code in the GIT interface and there may be a tweak there: access is different according to 'sourceparams' setting. Though your configuration is similar to mine, change a bit your lxr.conf to make sure.

    Comment out the four (4) lines related to 'sourceparams', i.e.:

    #   , 'sourceparams' =>
    #       { 'git_annotations' => 1
    #       , 'git_blame'       => 1
    #       }
    

    Note the hash (#) character at the beginning of lines. This is how you comment out statements in Perl.

    If error persist, I'll send you a patch for Git.pm to print debugging information.

    Regards,
    ajl

     
  • vinay kambam
    vinay kambam
    2014-02-07

    Hi,

    yes,I can see the files now.

    But I'm unable to see contents of few directories.I will send the screen shots to your mail

    Thanks,
    Vinay

     
  • Andre-Littoz
    Andre-Littoz
    2014-02-07

    It is very strange that you meet problems on some directories but not all. Now that we know you can access the Git repo, test with the following 'sourceparams' settings:

       , 'sourceparams' =>
           { 'git_annotations' => 1
           , 'git_blame'       => 0
           }
    

    If you get anew "Can't locate getline ...", then there's definitely something wrong in the Git interface. Unfortunately, I can't reproduce it here (Fedora distros, various levels on different computers from vintage PIII to recent 4-core, Apache 2.2 & 2.4, Cherokee, lighttpd, Nginx and thttpd).

     
  • vinay kambam
    vinay kambam
    2014-02-10

    With the above sourceparams settings problem persists.

    I'm unable to see the contents of files...getting error "can't locate object method getline via package IO::Handle .../GIT.pm line 217".

    I'm unable to see the contents of few directories too...getting error "can't locate object method getline via package IO::Handle .../Lang.pm line 186"

     
  • Chuck Garizas
    Chuck Garizas
    2014-02-10

    I was having similar problems; however, placing an explicit "use IO::Handle;" in lxr/lib/LXR/Lang.pm cleared them up.

     
  • vinay kambam
    vinay kambam
    2014-02-17

    It works !!!

    Thanks Chuck Garizas :)

     
  • Andre-Littoz
    Andre-Littoz
    2014-03-11

    Hello Vinay,

    I have just released 2.0.1 with Chuck's fix and also a correction for the Git 'range' function in lxr.conf (this fix will be taken into account only if you reconfigure your LXR).

    Please check if this cures your problem.

    André