<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
</head>
<body>
<p>Hi again,</p>
<p>As the patch in which this email is a reply to includes an <em>ABI</em>-breaking change, it cannot be backported to <code>3.0.0</code> <em>as-is</em>.</p>
<p>I am not sure how many users rely on <code>--recursive=none</code>, though it’s probably not many as it has been broken for quite some time, and I could not find a single ticket or post that asks about the breakage. With that in mind we have a few options:</p>
<ol style="list-style-type: decimal">
<li><p>remove support for <code>--recursive=none</code>, conditionally supporting it in <em>trunk</em> (though if removed in one, it is probably best to do it in both).</p></li>
<li><p>write a somewhat ugly backportable fix</p></li>
</ol>
<p>Alternative 2 will be ugly as there is no good way of retrieving the state of <code>--recursive</code> from within <code>rdh_file_is_ignored</code> nor <code>vlc_readdir_helper_add_item</code>, unless I am missing something that is not immediately obvious to me at the current time (sleep depravation).</p>
<p>One could, potentially, filter out directories when the items are about to get added to the playlist, which is also very ugly (in my opinion). The original implementation (from way way back) did the filtering in that which spawned the items, which is a requirement I do not want to impose on our current modules.</p>
<p>Input on the matter is more than welcome. I am not a fan of removing options as it is hard to prove what is actually being used in the world, but I could probably live with the removal of <code>--recursive=none</code> .</p>
<p>Best Regards,<br />
Filip</p>
<p>On 2018-07-20 10:15, Filip Roséen wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> fixes: #20865
 ---
  include/vlc_input_item.h |  1 +
  src/input/item.c         | 12 ++++++++++--
  2 files changed, 11 insertions(+), 2 deletions(-)

 diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
 index 4bd07c1733..a78ae13c89 100644
 --- a/include/vlc_input_item.h
 +++ b/include/vlc_input_item.h
 @@ -440,6 +440,7 @@ struct vlc_readdir_helper
      bool b_show_hiddenfiles;
      bool b_flatten;
      char *psz_ignored_exts;
 +    bool b_show_directories;
  };

  /**
 diff --git a/src/input/item.c b/src/input/item.c
 index f288d23c7d..8cc65722b8 100644
 --- a/src/input/item.c
 +++ b/src/input/item.c
 @@ -1406,11 +1406,12 @@ static bool rdh_file_has_ext(const char *psz_filename,
  }

  static bool rdh_file_is_ignored(struct vlc_readdir_helper *p_rdh,
 -                                const char *psz_filename)
 +                                const char *psz_filename, int i_type)
  {
      return (psz_filename[0] == '\0'
           || strcmp(psz_filename, ".") == 0
           || strcmp(psz_filename, "..") == 0
 +         || (!p_rdh->b_show_directories && i_type == ITEM_TYPE_DIRECTORY)
           || (!p_rdh->b_show_hiddenfiles && psz_filename[0] == '.')
           || rdh_file_has_ext(psz_filename, p_rdh->psz_ignored_exts));
  }
 @@ -1706,7 +1707,14 @@ void vlc_readdir_helper_init(struct vlc_readdir_helper *p_rdh,
          p_obj = p_var_obj;
      }

 +    char* psz_recursive = var_InheritString(p_obj, "recursive");
 +    bool b_show_directories = true;
 +    if (psz_recursive && !strcmp( psz_recursive, "none"))
 +        b_show_directories = false;
 +    free(psz_recursive);
 +
      p_rdh->p_node = p_node;
 +    p_rdh->b_show_directories = b_show_directories;
      p_rdh->b_show_hiddenfiles = var_InheritBool(p_obj, "show-hiddenfiles");
      p_rdh->psz_ignored_exts = var_InheritString(p_obj, "ignore-filetypes");
      bool b_autodetect = var_InheritBool(p_obj, "sub-autodetect-file");
 @@ -1794,7 +1802,7 @@ int vlc_readdir_helper_additem(struct vlc_readdir_helper *p_rdh,
          TAB_APPEND(p_rdh->i_slaves, p_rdh->pp_slaves, p_rdh_slave);
      }

 -    if (rdh_file_is_ignored(p_rdh, psz_filename))
 +    if (rdh_file_is_ignored(p_rdh, psz_filename, i_type))
          return VLC_SUCCESS;

      input_item_node_t *p_node = p_rdh->p_node;
 -- 
 2.18.0</code></pre>
</blockquote>
</body>
</html>