On 18. 6. 25 23:20, C. Michael Pilato wrote:
Disclaimer: I haven't looked at this codebase in a reeeeeally long time.  But this code in cmdline.c reads differently than my now-naive eyes would expect:

  /* If neither --non-interactive nor --force-interactive was passed,
   * be interactive if stdin is a terminal.
   * If --force-interactive was passed, always be interactive. */
  if (!force_interactive && !*non_interactive)
    *non_interactive = svn_cmdline__stdin_is_a_terminal();

This looks to have been introduced relatively recently, in r1925937 (https://svn.apache.org/viewvc/?view=revision&revision=1925937 <https://svn.apache.org/viewvc/?view=revision&revision=1925937>). I guess I would expect it to read:

  if (!force_interactive && !*non_interactive)
    *non_interactive = !svn_cmdline__stdin_is_a_terminal();

That is, be non-interactive if stdin is NOT a terminal.  But, yeah, see the disclaimer above. :-)

-- Mike


As the saying goes: dammit, Mike, not you again! :D

You're perfectly right, and our tests never once tickled this case. Adding that one bang fixes the problem for me. Writing a test for this case now  – it's already failing, I just have to adjust expected_stderr.

And yeah, looking at that diff now, it's kind of obvious. 🙄

Thanks!

-- Brane


On Wed, Jun 18, 2025 at 4:59 PM Branko Čibej <br...@apache.org> wrote:

    On 18. 6. 25 22:40, Branko Čibej wrote:
    This is with a fresh build of today's trunk:
    $ /Volumes/svn-test/trunk/subversion/svn/svn commit
    /Users/brane/src/svn/repos/trunk/subversion/svn/svn.c:3373: 
(apr_err=SVN_ERR_CL_INSUFFICIENT_ARGS)
    svn: E205001: Try 'svn help commit' for more information
    /Users/brane/src/svn/repos/trunk/subversion/svn/commit-cmd.c:185,
    /Users/brane/src/svn/repos/trunk/subversion/libsvn_client/commit.c:1097,
    /Users/brane/src/svn/repos/trunk/subversion/libsvn_client/commit.c:156: 
(apr_err=SVN_ERR_CL_INSUFFICIENT_ARGS)
    svn: E205001: Commit failed (details follow):
    /Users/brane/src/svn/repos/trunk/subversion/libsvn_client/commit.c:907,
    /Users/brane/src/svn/repos/trunk/subversion/svn/util.c:449: 
(apr_err=SVN_ERR_CL_INSUFFICIENT_ARGS)
    svn: E205001: Cannot invoke editor to get log message when non-interactive

    What? svn 1.14.5 works as expected, with the same
    ~/.subversion/config file. I have no clue where this
    'non-interactive' thing came from.

    Note: I have local changes in the macOS Keychain auth provider,
    but it never gets that far, since it fails during argument parsing.


    Non-interactive is indeed on, I traced this to
    svn_cl__get_log_message() where the baton says:
    lmb->non_interactive = 1. Also note that lmb->editor_cmd = NULL,
    which is kind of impossible given that I have one defined in
    ~/.subversion/config.


    -- Brane

    (lldb)
    Process 3212 stopped
    * thread #1, queue = 'com.apple.main-thread', stop reason = step over
         frame #0: 0x0000000100036658 
svn`svn_cl__get_log_message(log_msg=0x000000016fdfe508, 
tmp_file=0x000000016fdfe3c8, commit_items=0x000000015a110d70, 
baton=0x000000015a027a68, pool=0x000000015a013028) at util.c:350:51
        347       svn_stringbuf_t *message = NULL;
        348     
        349       /* Set default message.  */
    -> 350     default_msg = svn_stringbuf_create(APR_EOL_STR, pool);
        351       svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX);
        352       svn_stringbuf_appendcstr(default_msg, APR_EOL_STR 
APR_EOL_STR);
        353     
    Target 0: (svn) stopped.
    (lldb) p *lmb
    (log_msg_baton) {
       editor_cmd = 0x0000000000000000
       message = 0x0000000000000000
       message_encoding = 0x0000000000000000
       base_dir = 0x000000015a026e68 "/Users/brane/src/svn/repos/trunk"
       tmpfile_left = 0x0000000000000000
       non_interactive = 1
       config = 0x000000015a0138d0
       keep_locks = 0
       pool = 0x000000015a013028
    }

Reply via email to