Unable to refresh
RS
richard22j at zoho.com
Sat Mar 24 04:17:55 PDT 2018
On 24/03/18 09:43, Ralph Corderoy wrote:
>>>>> If you are typing `get_player .* --since 70' into a Linux shell
>>
>
> The shell is expanding globs before invoking get_iplayer, thus they're
> not seen by get_iplayer if they match anything. If they don't match
> anything then they normally remain and are passed to get_iplayer anyway.
> For the arguments get_iplayer does see, it decides to interpret some of
> them as regexps.
>
> «get_iplayer Railway» has no glob metacharacters to expand so one
> argument is passed to get_iplayer, it uses it as a regexp, it has no
> regexp metacharacters so effectively is a substring search of the
> titles.
>
> «get_iplayer R.*way» has a glob metacharacter, the «*», the shell looks
> at the current directory for entries starting «R.» and ending «way».
> There are none. The glob remains, unexpanded. get_iplayer has one
> argument, «R.*way» that it uses as a regexp. There's two regexp
> metacharacters, «.*», meaning zero or more of any character, used in the
> search.
>
> «get_iplayer R.*way» is run again, and again has a glob, the «*». This
> time, the current directory has «R.steinway» in it. The argument with
> the glob is expanded into that and get_iplayer has one argument,
> «R.steinway», that's used as a regexp. It's unlikely to match any
> titles, e.g. «Resteinway».
>
> To avoid glob expansion, quote the glob metacharacters, «get_iplayer
> 'R.*way'», and get_iplayer sees the regexp «R.*way».
>
>> One thing that does not appear to have happened is infinite recursion,
>> or even matching of additional programmes.
>
> Your unquoted «.*» on Linux would often expand to «. ..», and perhaps
> more if you've other `dot' files present. These are two regexps
> interpreted by get_iplayer. It prints titles matching either. Since
> anything matching the second is also matched by the first, you are
> seeing any title at least one character long. That's almost like «.*»
> and «^» except that a zero-length title won't be matched.
>
Hi Ralph
I can see that in some special cases leaving out the quotes will give
wrong results. I only wanted a crude indication of how long it had been
since refreshing the cache had been working, but that is no excuse for
getting it wrong.
I clearly still need to think it through further. I would have expected
get_iplayer * --since 110
to match 67 programmes, but it matches 0.
I would have expected
get_iplayer '*' --since 110
to match 0 programmes but it matches 67.
If I put in an invalid regex
get_iplayer *. --since 110
get_iplayer '*.' --since 110
both seem to reach Perl as a regex even though the first has a bash
wildcard.
Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE
./ at /usr/bin/get_iplayer line 1245.
Best wishes
Richard
More information about the get_iplayer
mailing list