Bug report, unexpected tilde non-replacement
(1) By Brian Tiffin (btiffin) on 2020-08-31 04:58:50 [source]
prompt$ fossil init --template=~/repos/tnt.fossil ~/repos/badsquiggle.fossil
SQLITE_CANTOPEN(14): cannot open file at line 39705 of [6c716f4b55]
SQL: ATTACH DATABASE '~/repos/tnt.fossil' AS 'settingSrc' KEY ''
SQLITE_CANTOPEN(14): os_unix.c:39705: (2) open(/home/btiffin/inst/fossil/~/repos/tnt.fossil) - No such file or directory
SQL: ATTACH DATABASE '~/repos/tnt.fossil' AS 'settingSrc' KEY ''
SQLITE_CANTOPEN(14): statement aborts at 4: [ATTACH DATABASE '~/repos/tnt.fossil' AS 'settingSrc' KEY ''] unable to open database: ~/repos/tnt.fossil
SQL: ATTACH DATABASE '~/repos/tnt.fossil' AS 'settingSrc' KEY ''
Database error: unable to open database: ~/repos/tnt.fossil: {ATTACH DATABASE '~/repos/tnt.fossil' AS 'settingSrc' KEY ''}
First encountered in a 2.12 build, just pulled latest (which produced the above capture).
prompt$ fossil version
This is fossil version 2.13 [b9fa7e2871] 2020-08-30 20:29:56 UTC
Easy fix, either change dir or use full path in the --template name. Still a bug, I think.
Aside: I have a small COBOL program to exercise the wordexp(3)
word expansion. Bash does not expand the template tilde, seeing as it's not the first character of a word, but wordexp(3)
seems to.
prompt$ ./wedemo --template=~/repos ~/repos
function word-expansion of
:--template=~/repos /home/btiffin/repos:
+0000000050 :--template=/home/btiffin/repos /home/btiffin/repos:
prompt$ ./wedemo '--template=~/repos ~/repos'
function word-expansion of
:--template=~/repos ~/repos:
+0000000050 :--template=/home/btiffin/repos /home/btiffin/repos:
Not sure if --template=~/somedir
should actually work, but the error as it stands seems fairly striking.
Have good, make well
(2) By Warren Young (wyoung) on 2020-08-31 05:49:46 in reply to 1 [link] [source]
On a POSIX system, I’d say it would be a bug if Fossil did a second-pass glob expansion, since that would effectively prevent single quote and backslash escaping of special characters.
Instead of using tilde inside a parameter like that, use $HOME
.
(3) By Warren Young (wyoung) on 2020-08-31 07:11:28 in reply to 2 [link] [source]
In case you're not buying my argument, I offer these supports:
Experiment: Substitute "
/bin/echo
" for "fossil
". It still doesn't do what you think it should. That's because this is a matter for the shell, not for the called program.The IEEE Std 1003.1-2017/SUSv4 standard. (Successor to POSIX.)
(4) By Richard Hipp (drh) on 2020-08-31 11:27:50 in reply to 1 [link] [source]
Use a space rather than an "=" in between the option and its value, so that the shell knows to expand the "~"
fossil init --template ~/repos/tnt.fossil ~/repos/badsquiggle.fossil
# space -----^
Tilda-expansion is a function of your shell (probably Bash) not of the application or OS. Not every unix shell does tilda-expansion. The original Bourne-shell did not, for example.
(5.2) By Brian Tiffin (btiffin) on 2020-09-02 07:12:40 edited from 5.1 in reply to 4 [link] [source]
Ok. No problem with following along with what counts for words in the shell.
The bug report was mainly about the feedback, and I may have placed too much focus on the tilde issue.
More to report.
While toying around, this occurred:
prompt$ fossil init --template=unkown ~/junk/trial.fossil
SQLITE_ERROR(1): no such table: settingSrc.config in "INSERT OR REPLACE INTO config SELECT name,value,mtime FROM settingSrc.config WHERE (name IN ('css','header','footer','details','js','logo-mimetype','logo-image','backgroun
Database error: no such table: settingSrc.config: {INSERT OR REPLACE INTO config SELECT name,value,mtime FROM settingSrc.config WHERE (name IN ('css','header','footer','details','js','logo-mimetype','logo-image','background-mimetype','background-image','icon-mimetype','icon-image','timeline-block-markup','timeline-date-format','timeline-default-style','timeline-dwelltime','timeline-closetime','timeline-max-comment','timeline-plaintext','timeline-truncate-at-blank','timeline-tslink-info','timeline-utc','adunit','adunit-omit-if-admin','adunit-omit-if-user','default-csp','sitemap-docidx','sitemap-download','sitemap-license','sitemap-contact','safe-html','th1-docs','th1-hooks','th1-setup','th1-uri-regexp','project-name','short-project-name','project-description','index-page','manifest','binary-glob','clean-glob','ignore-glob','keep-glob','crlf-glob','crnl-glob','encoding-glob','empty-dirs','dotfiles','parent-project-code','parent-project-name','hash-policy','comment-format','mimetypes','forbid-delta-manifests','mv-rm-files','ticket-table','ticket-common','ticket-change','ticket-newpage','ticket-viewpage','ticket-editpage','ticket-reportlist','ticket-report-template','ticket-key-template','ticket-title-expr','ticket-closed-expr','xfer-common-script','xfer-push-script','xfer-commit-script','xfer-ticket-script') OR name IN ('access-log','admin-log','allow-symlinks','auto-captcha','auto-hyperlink','auto-shun','autosync','autosync-tries','backoffice-disable','backoffice-logfile','backoffice-nodelay','binary-glob','case-sensitive','clean-glob','clearsign','comment-format','crlf-glob','crnl-glob','default-csp','default-perms','diff-binary','diff-command','dont-push','dotfiles','editor','email-admin','email-self','email-send-command','email-send-db','email-send-dir','email-send-method','email-send-relayhost','email-subname','email-url','empty-dirs','encoding-glob','exec-rel-paths','fileedit-glob','forbid-delta-manifests','gdiff-command','gmerge-command','hash-digits','hooks','http-port','https-login','ignore-glob','keep-glob','localauth','lock-timeout','main-branch','manifest','max-loadavg','max-upload','mimetypes','mtime-changes','mv-rm-files','pgp-command','proxy','redirect-to-https','relative-paths','repo-cksum','repolist-skin','safe-html','self-register','ssh-command','ssl-ca-location','ssl-identity','tclsh','th1-docs','th1-hooks','th1-setup','th1-uri-regexp','uv-sync','web-browser') OR name GLOB 'walias:/*') AND name NOT GLOB 'project-*' AND name NOT GLOB 'short-project-*';}
An overly verbose, not very useful piece of feedback.
I actually meant to type "unknown" and made the "unkown" typo. Did more trials, just to see what to expect with file not found errors:
prompt$ fossil ls -R unknown
repository does not exist or is in an unreadable directory: unknown
Now, that is fossil worthy feedback. :-) Then I also noticed the typo
prompt$ fossil ls -R unkown
not a valid repository: unkown
And then I thought, ??? different file-not-found filenames create different messages?
Well, not really, it uncovered another issue. The first --template unkown
created an empty file in the current working dir
prompt$ ls -go unkown
-rw-r--r-- 1 0 Sep 2 02:35 unkown
Instead of reporting a user end problem with tilde expansion expectations, I'll report a bug that init --template
with an invalid filename, will create a zero length file using the invalid name. Second point being that the sequence produces less than thrilling error feedback that should be more akin to template repository does not exist
, I think.
Have good, make well
(6) By sean (jungleboogie) on 2020-09-02 16:20:11 in reply to 5.2 [link] [source]
I'll report a bug that init --template with an invalid filename, will create a zero length file using the invalid name.
Just a minor point of clarification...even if the filename is accurate but it is not really a template repo, you get the same message.
$ touch unknown
$ fossil init --template=unknown btiffin.fossil
SQLITE_ERROR(1): no such table: settingSrc.config in "INSERT OR REPLACE INTO config SELECT name,value,mtime FROM set
tingSrc.config WHERE (name IN ('css','header','footer','details','js','logo-mimetype','logo-image','backgroun
Database error: no such table: settingSrc.config: {INSERT OR REPLACE INTO config SELECT name,value,mtime FROM settin
gSrc.config WHERE (name IN ('css','header','footer','details','js','logo-mimetype','logo-image','background-mimetyp
e','background-image','icon-mimetype','icon-image','timeline-block-markup','timeline-date-format','timeline-default-
style','timeline-dwelltime','timeline-closetime','timeline-max-comment','timeline-plaintext','timeline-truncate-at-b
lank','timeline-tslink-info','timeline-utc','adunit','adunit-omit-if-admin','adunit-omit-if-user','default-csp','sit
emap-docidx','sitemap-download','sitemap-license','sitemap-contact','safe-html','th1-setup','th1-uri-regexp','projec
t-name','short-project-name','project-description','index-page','manifest','binary-glob','clean-glob','ignore-glob',
'keep-glob','crlf-glob','crnl-glob','encoding-glob','empty-dirs','dotfiles','parent-project-code','parent-project-na
me','hash-policy','comment-format','mimetypes','forbid-delta-manifests','mv-rm-files','ticket-table','ticket-common'
,'ticket-change','ticket-newpage','ticket-viewpage','ticket-editpage','ticket-reportlist','ticket-report-template','
ticket-key-template','ticket-title-expr','ticket-closed-expr','xfer-common-script','xfer-push-script','xfer-commit-s
cript','xfer-ticket-script') OR name IN ('access-log','admin-log','allow-symlinks','auto-captcha','auto-hyperlink','
auto-shun','autosync','autosync-tries','backoffice-disable','backoffice-logfile','backoffice-nodelay','binary-glob',
'case-sensitive','clean-glob','clearsign','comment-format','crlf-glob','crnl-glob','default-csp','default-perms','di
ff-binary','diff-command','dont-push','dotfiles','editor','email-admin','email-self','email-send-command','email-sen
d-db','email-send-dir','email-send-method','email-send-relayhost','email-subname','email-url','empty-dirs','encoding
-glob','exec-rel-paths','fileedit-glob','forbid-delta-manifests','gdiff-command','gmerge-command','hash-digits','hoo
ks','http-port','https-login','ignore-glob','keep-glob','localauth','lock-timeout','main-branch','manifest','max-loa
davg','max-upload','mimetypes','mtime-changes','mv-rm-files','pgp-command','proxy','redirect-to-https','relative-pat
hs','repo-cksum','repolist-skin','safe-html','self-register','ssh-command','ssl-ca-location','ssl-identity','tclsh',
'th1-setup','th1-uri-regexp','uv-sync','web-browser') OR name GLOB 'walias:/*') AND name NOT GLOB 'project-*'
AND name NOT GLOB 'short-project-*';}