"Neiss, Guenter" <GUENTER.NEISS_at_plarad.de> writes:
> I tried all the things mentioned at: http://subversion.tigris.org/bugs.html
> But didn't find that this bug/problem was already mentioned..
>
> So I issue this report.
>
> Just to be complete here is my environment:
> OS: SVNClient: WinXP, SVNServe: Windows Server 2003
> SVN: Release: 1.4.2 & 1.4.4 (but I am pretty shure that it's the same with 1.5,
> can't upgrade at the moment)
>
> Proble description:
> When running a hooks script, that get's some information via stdin
> (pre-revprop-change for ex.) this can't be used inside a simple BAT script.
>
> IMHO this comes, because stdin lacks an EOF.
Sorry, I don't mean to be dense, but I read your report twice and didn't
quite understand the problem. Can you describe the exact symptoms?
Give an actual BAT script, explain what it's trying to do, and show us
how it is prevented from doing that thing.
Thank you,
-Karl
> For Windows BAT file this may be implemented by simply writing EOF after
> writing the value into stdin, but this isn't the right way (IMHO).
>
> The correct way is to create the (tmporary) file copy it's handle,
> then use one handle to write & close the file
> And use the other to pass it to the child process.
> This handle was closed when the child process has terminated, which results in
> the file being deleted (because it's created with 'del_on_close').
>
> When doing so the child process see a real EOL even if he reads the file in
> binary mode.
>
> IMHO this is valid under Windows as well as under *nix (unix, linux)...
>
> I locate the problem inside 'hooks.c' inside 'libsvn_repos'' (using a checkout
> from http://svn.collab.net/repos/svn/trunk/subversion/libsvn_repos Revision
> 31970).
>
> The real work (creating the temporary file) is done inside function
> 'create_temp_file':
>
> /* Create a temporary file F that will automatically be deleted when it is
> closed. Fill it with VALUE, and leave it open and rewound, ready to be
> read from. */
> static svn_error_t *
> create_temp_file(apr_file_t **f, const svn_string_t *value, apr_pool_t *pool)
> {
> const char *dir;
> apr_off_t offset = 0;
>
> SVN_ERR(svn_io_temp_dir(&dir, pool));
> SVN_ERR(svn_io_open_unique_file2(f, NULL,
> svn_path_join(dir, "hook-input", pool),
> "", svn_io_file_del_on_close, pool));
> SVN_ERR(svn_io_file_write_full(*f, value->data, value->len, NULL, pool));
> SVN_ERR(svn_io_file_seek(*f, APR_SET, &offset, pool));
> return SVN_NO_ERROR;
> }
>
> This should be changed to:
>
> I look the first time at the subversion source code, so please forgive me if I
> don't understood all methods use therein ;-)
>
> /* Create a temporary file F that will automatically be deleted when it is
> closed. Fill it with VALUE, and leave it open and rewound, ready to be
> read from. */
> static svn_error_t *
> create_temp_file(apr_file_t **f, const svn_string_t *value, apr_pool_t *pool)
> {
> const char *dir;
> apr_off_t offset = 0;
> apr_file_t *wf; // the handle we use to write to
>
> SVN_ERR(svn_io_temp_dir(&dir, pool));
> SVN_ERR(svn_io_open_unique_file2(&wf, NULL,
> svn_path_join(dir, "hook-input", pool),
> "", svn_io_file_del_on_close, pool));
>
> // only principell, must be replaced by the functions used inside SVN
> *f = duplicate_handle( wf, pool ); // create the handle pased back to the
> caller
>
> SVN_ERR(svn_io_file_write_full(wf, value->data, value->len, NULL, pool));
> // dont know how to enshure *f was closed on error here
>
> // no need to seek on this handle
> // SVN_ERR(svn_io_file_seek(*f, APR_SET, &offset, pool));
>
> SVN_ERR(svn_io_file_close(wf, pool));
> // dont know how to enshure *f was closed on error here
>
> return SVN_NO_ERROR;
> }
>
>
> Hope that is enaught information :-)
>
>
>
>
> MfG
> G. Neiß
>
> ##########################################
> # Herr Dipl.-Ing. Günter Neiß #
> # Maschinenfabrik Wagner GmbH & Co.KG #
> # Birrenbachshöhe 17 #
> # D-53798 Much #
> # Tel.: +49 2245 62-18 #
> # Fax: +49 2245 62-55 #
> # mailto:G.Neiss_at_plarad.de #
> # http://www.plarad.de #
> # #
> # Handelsregister Siegburg HRA 1704 #
> # Pers. Haftende Ges.: Wagner GmbH #
> # Handelsregister Siegburg HRB 331 #
> # Geschäftsführer: Paul-Heinz Wagner #
> ##########################################
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-02 23:57:03 CEST