You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Aleksandr Zhuikov (JIRA)" <ji...@codehaus.org> on 2011/01/24 21:35:58 UTC

[jira] Created: (SCM-598) String index out of bounds while trying to commit limited file set to Git

String index out of bounds while trying to commit limited file set to Git
-------------------------------------------------------------------------

                 Key: SCM-598
                 URL: http://jira.codehaus.org/browse/SCM-598
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-provider-git
    Affects Versions: 1.4
         Environment: Ubuntu 10
            Reporter: Aleksandr Zhuikov
         Attachments: Screenshot.png

I encountered String index out of bounds while trying to commit limited file set to Git.

if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.

I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Mark Struberg (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252798#action_252798 ] 

Mark Struberg commented on SCM-598:
-----------------------------------

another thing: can you please tell us what you got as parameter path and the getPath and getAbsolutePath values? txs!

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Aleksandr Zhuikov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=253517#action_253517 ] 

Aleksandr Zhuikov commented on SCM-598:
---------------------------------------

Thanks for fixing it!

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Mark Struberg
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy updated SCM-598:
-----------------------------

    Patch Submitted: [Yes]

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Aleksandr Zhuikov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252825#action_252825 ] 

Aleksandr Zhuikov commented on SCM-598:
---------------------------------------

As you said: "f.getPath() might only return the relative path", but on line 57 you substring absolute path from this relative path.
I have to admit, that my fix seems to be wrong: if getPath() always returns relative path, than the whole block does not make any sense.

Made simple test:
    File file = new File("test.xml");
    System.out.println(file.getPath());
    System.out.println(file.getAbsolutePath());
Output:
  test.xml
  /home/aleksz/projects/koaba/SCMTest/test.xml

Out of bounds comes when you substring "/home/aleksz/projects/koaba/SCMTest/".length() from "test.xml"

P.S
Ubuntu 10.10
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Mark Struberg (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252797#action_252797 ] 

Mark Struberg commented on SCM-598:
-----------------------------------

hmm, to me the getAbsolutePath looks ok. The reason in the context is the following:

f.getPath() _might_ only return the relative path (if no absolute is used in the configuration). Thus I use f.getAbsolutePath() to decide if we should get rid of the path prefix. This is needed because some git commands do not like absolute paths as parameters.

What java version are you using, what linux version are you using?

I successfully tested this with Sun java impls starting from 1.4.2 up to the latest 1.6.0_21 under Fedora 9-14 32 and 64 bit versions.

LieGrue,
strub

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Mark Struberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg closed SCM-598.
-----------------------------

    Resolution: Fixed

I've fixed the relativePath logic now. Txs 4 reporting this problem!

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Mark Struberg
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy updated SCM-598:
-----------------------------

    Patch Submitted:   (was: [Yes])
      Fix Version/s: 1.5
           Assignee: Olivier Lamy

yes please provide a patch with svn diff .

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SCM-598) String index out of bounds while trying to commit limited file set to Git

Posted by "Aleksandr Zhuikov (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksandr Zhuikov updated SCM-598:
----------------------------------

    Attachment: GitCommandLineUtils.java.patch

Attaching patch

> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
>                 Key: SCM-598
>                 URL: http://jira.codehaus.org/browse/SCM-598
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.4
>         Environment: Ubuntu 10
>            Reporter: Aleksandr Zhuikov
>            Assignee: Olivier Lamy
>             Fix For: 1.5
>
>         Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file set to Git.
> if statement was checking if file's absolute path was starting with working directory absoulute path, but stripping absoulute path from the value returned by getPath(). At least in Linux this getPath and getAbsolutePath did not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a wrong place :) Attachment has screenshot with diff from Github.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira