[PATCH] sb: Restrict file name length

Chris Johns chrisj at rtems.org
Thu Jun 8 05:42:06 UTC 2017


On 08/06/2017 15:22, Sebastian Huber wrote:
> ---
>  source-builder/sb/download.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
> index dd7880d..984bbaa 100644
> --- a/source-builder/sb/download.py
> +++ b/source-builder/sb/download.py
> @@ -184,6 +184,9 @@ def _http_parser(source, pathkey, config, opts):
>          # Wipe out everything special in the file name.
>          #
>          source['file'] = re.sub(r'[^a-zA-Z0-9.\-]+', '-', source['file'])
> +        max_file_len = 127
> +        if len(source['file']) > max_file_len:
> +            raise error.general('file name length is greater than %i (maybe use --rsb-file=FILE option): %s' % (max_file_len, source['file']))

Good idea.

Can we keep close(ish) to 80 columns?

raise error.general('name longer than %i (use --rsb-file=FILE): %s' % \
                    (max_file_len, source['file']))
?

Please push when ready.

Thanks
Chris



More information about the devel mailing list