[jira] [Commented] (SVN-4711) invalid xml file produced by: svn log --xml --verbose --use-merge-history --search

"Daniel Shahaf (Jira)" <[email protected]>
Newsgroups gmane.comp.version-control.subversion.issues
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/SVN-4711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17098150#comment-17098150 ] 

Daniel Shahaf commented on SVN-4711:
------------------------------------

The problem is in the cmdline client's filtering code.  The "Match search pattern before XML-escaping" block in svn_cl__log_entry_receiver_xml() doesn't print the opening "logentry" tag ever, but the preceding block in the same function assumes that an opening tag will have been printed for every call where has_children is true, regardless of filtering.

> invalid xml file produced by: svn log --xml --verbose --use-merge-history --search
> ----------------------------------------------------------------------------------
>
>                 Key: SVN-4711
>                 URL: https://issues.apache.org/jira/browse/SVN-4711
>             Project: Subversion
>          Issue Type: Bug
>    Affects Versions: 1.9.5, 1.9.7, trunk
>         Environment: OS:
> * Kubuntu 17.10 (Linux 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux)
> * Windows 7
> Checked with svn versions:
> * svn, version 1.9.7 (r1800392) compiled Aug 17 2017, 10:20:03 on x86_64-pc-linux-gnu
> * svn version 1.9.5 (r1770682) compiled Nov 26 2016, 14:22:31 on x86-microsoft-windows)
> * also trunk 1.11.0-dev confirmed by "danielsh" on IRC: http://sprunge.us/YYbL (thanks)
> Additional information:
> * The compiler and configuration options you built Subversion with: from apt
> * Any private modifications you made to your Subversion: (none)
> * The version of Berkeley DB you're running Subversion with, if any:  (none)
>            Reporter: Martin Obermeir
>            Priority: Major
>         Attachments: tests.zip
>
>
> {{svn log \-\-xml}} produces an invalid xml when the {{\-\-use-merge-history}} option is combined with {{\-\-search}}
> Example:
> {code:none}
> svn log --xml --verbose --use-merge-history --search "msg1"
> {code}
> The xml contains two closing {{</logentry>}} tags, but only one opening {{<logentry>}} tag.
> The bug can be easily reproduced with the script attached to this issue, it is also available here: https://gist.github.com/anonymous/91aa228d6c22bff7ec2cbba2aecb2cd3
> *Expected output:*
>      xml with just one "</logentry>" line
> *Actual output (see last lines):*
> {code:none}
>      <?xml version="1.0" encoding="UTF-8"?>
>      <log>
>      <logentry
>      reverse-merge="false"
>      revision="3">
>      <author>xyz</author>
>      <date>2017-12-11T10:14:38.084171Z</date>
>      <paths>
>      <path
>      kind="file"
>      action="M"
>      prop-mods="false"
>      text-mods="true">/trunk/iota</path>
>      </paths>
>      <msg>msg1</msg>
>      </logentry>
>      </logentry>
>      </log>
> {code}
> Script to reproduce: https://gist.github.com/anonymous/91aa228d6c22bff7ec2cbba2aecb2cd3
> {code:none}
> #!/bin/sh
> ##############################################################################
> ##                                                                          ##
> ##  This is a template for writing Subversion bug reproduction scripts.     ##
> ##                                                                          ##
> ##  It creates a repository containing the standard Greek Tree (see         ##
> ##  http://svn.apache.org/repos/asf/subversion/trunk/subversion/tests/greek-tree.txt) ##
> ##  and checks out a working copy containing that tree.  Please adjust      ##
> ##  this script however you need to to demonstrate your bug.  When it's     ##
> ##  ready, post the bug report to [email protected] -- after        ##
> ##  http://subversion.apache.org/docs/community-guide/issues.html#reporting-bugs, ##
> ##  of course.                                                              ##
> ##                                                                          ##
> ##############################################################################
> # You might need to adjust these lines to point to your
> # compiled-from-source Subversion binaries, if using those:
> if [ -z "$SVN" ]; then
>   SVN=`which svn`
>   # SVNSERVE=`which svnserve`
>   SVNADMIN=`which svnadmin`
> fi
> # Make sure we don't use $HOME/.subversion/.
> if [ ! -d "`pwd`/svn-repro-config-dir" ]; then mkdir "`pwd`/svn-repro-config-dir"; fi
> SVN="${SVN} --config-dir=`pwd`/svn-repro-config-dir"
> SVNADMIN="${SVNADMIN} --config-dir=`pwd`/svn-repro-config-dir"
> # SVNSERVE="${SVNSERVE} --config-dir=`pwd`/svn-repro-config-dir"
> # Use English output.
> LC_ALL=C; export LC_ALL
> # Select an access method.  If svn://, the svnserve setup is
> # handled automagically by this script; but if http://, then
> # you'll have to configure it yourself first.
> #
> # URL=http://localhost/SOMETHING/repos
> # URL=svn://localhost/repos
> URL=file:///`pwd`/repos
> if [ -e repos ]; then rm -rf repos; fi
> if [ -e wc ]; then rm -rf wc; fi
> if [ -e import-me ]; then rm -rf import-me; fi
> ${SVNADMIN} create repos
> # These are for svnserve only.
> echo "[general]" > repos/conf/svnserve.conf
> echo "anon-access = write" >> repos/conf/svnserve.conf
> echo "auth-access = write" >> repos/conf/svnserve.conf
> # The server will only be contacted if $URL is svn://foo, of course.
> # ${SVNSERVE} --pid-file svnserve-pid -d -r `pwd`
> # And put the kill command in a file, in case need to run it manually.
> # echo "kill -9 `cat svnserve-pid`" > k
> # chmod a+rwx k
> echo "### Making a Greek Tree for import..."
> mkdir import-me
> mkdir import-me/trunk
> mkdir import-me/tags
> mkdir import-me/branches
> mkdir import-me/trunk/A
> mkdir import-me/trunk/A/B/
> mkdir import-me/trunk/A/C/
> mkdir import-me/trunk/A/D/
> mkdir import-me/trunk/A/B/E/
> mkdir import-me/trunk/A/B/F/
> mkdir import-me/trunk/A/D/G/
> mkdir import-me/trunk/A/D/H/
> echo "This is the file 'iota'."        > import-me/trunk/iota
> echo "This is the file 'A/mu'."        > import-me/trunk/A/mu
> echo "This is the file 'A/B/lambda'."  > import-me/trunk/A/B/lambda
> echo "This is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha
> echo "This is the file 'A/B/E/beta'."  > import-me/trunk/A/B/E/beta
> echo "This is the file 'A/D/gamma'."   > import-me/trunk/A/D/gamma
> echo "This is the file 'A/D/G/pi'."    > import-me/trunk/A/D/G/pi
> echo "This is the file 'A/D/G/rho'."   > import-me/trunk/A/D/G/rho
> echo "This is the file 'A/D/G/tau'."   > import-me/trunk/A/D/G/tau
> echo "This is the file 'A/D/H/chi'."   > import-me/trunk/A/D/H/chi
> echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega
> echo "This is the file 'A/D/H/psi'."   > import-me/trunk/A/D/H/psi
> echo "### Done."
> echo ""
> echo "### Importing it..."
> (cd import-me; ${SVN} import -q -m "Initial import." ${URL})
> echo "### Done."
> echo ""
> ${SVN} co -q ${URL}/trunk wc
> cd wc
> echo "### This is where your reproduction recipe goes. ###"
> svn cp ${URL}/trunk ${URL}/branches/b1 -m "b1"
> echo x >> iota
> svn ci iota -m "msg1"
> svn switch ${URL}/branches/b1
> svn merge ${URL}/trunk
> svn ci -m "merged"
> echo "### The following command will produce invalid xml (duplicated </logentry> tag):"
> svn log --xml --verbose --use-merge-history --search "msg1"
> # Environment:
> #
> # Your operating system
> # -  Kubuntu 17.10 (Linux 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux)
> # The release and/or revision of Subversion
> # -  svn, version 1.9.7 (r1800392)
> # -   compiled Aug 17 2017, 10:20:03 on x86_64-pc-linux-gnu
> # The compiler and configuration options you built Subversion with
> # -  (from apt)
> # Any private modifications you made to your Subversion
> # -  (none)
> # The version of Berkeley DB you're running Subversion with, if any
> # -  (none)
> # Anything else that could possibly be relevant. Err on the side of too much information, rather than too little.
> # - Expected output:
> #     xml with just one "</logentry>" line
> # - Actual output (see last lines):
> #     <?xml version="1.0" encoding="UTF-8"?>
> #     <log>
> #     <logentry
> #     reverse-merge="false"
> #     revision="3">
> #     <author>xyz</author>
> #     <date>2017-12-11T10:14:38.084171Z</date>
> #     <paths>
> #     <path
> #     kind="file"
> #     action="M"
> #     prop-mods="false"
> #     text-mods="true">/trunk/iota</path>
> #     </paths>
> #     <msg>msg1</msg>
> #     </logentry>
> #     </logentry>
> #     </log>
> cd ..
> # Put kill command in a file, in case need to run it manually.
> # echo "kill -9 `cat svnserve-pid`" > k
> # chmod a+rwx k
> # ./k
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.