mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.0272: ":helptags ALL" gives error for some directories
Problem: ":helptags ALL" gives error for directories without write permission. (Matěj Cepl) Solution: Ignore errors for ":helptags ALL". (Ken Takata, closes #5026, closes #5652)
This commit is contained in:
parent
82f654e092
commit
414b796627
@ -5920,7 +5920,8 @@ helptags_one(
|
|||||||
char_u *dir, // doc directory
|
char_u *dir, // doc directory
|
||||||
char_u *ext, // suffix, ".txt", ".itx", ".frx", etc.
|
char_u *ext, // suffix, ".txt", ".itx", ".frx", etc.
|
||||||
char_u *tagfname, // "tags" for English, "tags-fr" for French.
|
char_u *tagfname, // "tags" for English, "tags-fr" for French.
|
||||||
int add_help_tags) // add "help-tags" tag
|
int add_help_tags, // add "help-tags" tag
|
||||||
|
int ignore_writeerr) // ignore write error
|
||||||
{
|
{
|
||||||
FILE *fd_tags;
|
FILE *fd_tags;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
@ -5964,7 +5965,8 @@ helptags_one(
|
|||||||
fd_tags = mch_fopen((char *)NameBuff, "w");
|
fd_tags = mch_fopen((char *)NameBuff, "w");
|
||||||
if (fd_tags == NULL)
|
if (fd_tags == NULL)
|
||||||
{
|
{
|
||||||
semsg(_("E152: Cannot open %s for writing"), NameBuff);
|
if (!ignore_writeerr)
|
||||||
|
semsg(_("E152: Cannot open %s for writing"), NameBuff);
|
||||||
FreeWild(filecount, files);
|
FreeWild(filecount, files);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6165,7 +6167,7 @@ helptags_one(
|
|||||||
* Generate tags in one help directory, taking care of translations.
|
* Generate tags in one help directory, taking care of translations.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
do_helptags(char_u *dirname, int add_help_tags)
|
do_helptags(char_u *dirname, int add_help_tags, int ignore_writeerr)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MULTI_LANG
|
#ifdef FEAT_MULTI_LANG
|
||||||
int len;
|
int len;
|
||||||
@ -6251,7 +6253,7 @@ do_helptags(char_u *dirname, int add_help_tags)
|
|||||||
ext[1] = fname[5];
|
ext[1] = fname[5];
|
||||||
ext[2] = fname[6];
|
ext[2] = fname[6];
|
||||||
}
|
}
|
||||||
helptags_one(dirname, ext, fname, add_help_tags);
|
helptags_one(dirname, ext, fname, add_help_tags, ignore_writeerr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ga_clear(&ga);
|
ga_clear(&ga);
|
||||||
@ -6259,14 +6261,15 @@ do_helptags(char_u *dirname, int add_help_tags)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
// No language support, just use "*.txt" and "tags".
|
// No language support, just use "*.txt" and "tags".
|
||||||
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags);
|
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags,
|
||||||
|
ignore_writeerr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
helptags_cb(char_u *fname, void *cookie)
|
helptags_cb(char_u *fname, void *cookie)
|
||||||
{
|
{
|
||||||
do_helptags(fname, *(int *)cookie);
|
do_helptags(fname, *(int *)cookie, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6300,7 +6303,7 @@ ex_helptags(exarg_T *eap)
|
|||||||
if (dirname == NULL || !mch_isdir(dirname))
|
if (dirname == NULL || !mch_isdir(dirname))
|
||||||
semsg(_("E150: Not a directory: %s"), eap->arg);
|
semsg(_("E150: Not a directory: %s"), eap->arg);
|
||||||
else
|
else
|
||||||
do_helptags(dirname, add_help_tags);
|
do_helptags(dirname, add_help_tags, FALSE);
|
||||||
vim_free(dirname);
|
vim_free(dirname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,18 @@ func Test_helptag_cmd()
|
|||||||
" The following tests fail on FreeBSD for some reason
|
" The following tests fail on FreeBSD for some reason
|
||||||
if has('unix') && !has('bsd')
|
if has('unix') && !has('bsd')
|
||||||
" Read-only tags file
|
" Read-only tags file
|
||||||
call writefile([''], 'Xdir/tags')
|
call mkdir('Xdir/doc', 'p')
|
||||||
call setfperm('Xdir/tags', 'r-xr--r--')
|
call writefile([''], 'Xdir/doc/tags')
|
||||||
call assert_fails('helptags Xdir', 'E152:', getfperm('Xdir/tags'))
|
call writefile([], 'Xdir/doc/sample.txt')
|
||||||
call delete('Xdir/tags')
|
call setfperm('Xdir/doc/tags', 'r-xr--r--')
|
||||||
|
call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags'))
|
||||||
|
|
||||||
|
let rtp = &rtp
|
||||||
|
let &rtp = 'Xdir'
|
||||||
|
helptags ALL
|
||||||
|
let &rtp = rtp
|
||||||
|
|
||||||
|
call delete('Xdir/doc/tags')
|
||||||
|
|
||||||
" No permission to read the help file
|
" No permission to read the help file
|
||||||
call setfperm('Xdir/a/doc/sample.txt', '-w-------')
|
call setfperm('Xdir/a/doc/sample.txt', '-w-------')
|
||||||
|
@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
272,
|
||||||
/**/
|
/**/
|
||||||
271,
|
271,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user