Fossil Forum

Bug report: working directory name can not contain a percent '%' sign
Login

Bug report: working directory name can not contain a percent '%' sign

Bug report: working directory name can not contain a percent '%' sign

(1) By anonymous on 2020-03-15 15:17:57 [link]

Hi!

Please advise where to send this bug report to... Here it comes:

When a repository is initialised and the working directory from which
the repository is opened contains a '%' then the following error is
printed:


    SQLITE_ERROR: unrecognized token: "'/tmp/tmp.fzTqappNuh/%"
    fossil: unrecognized token: "'/tmp/tmp.fzTqappNuh/%": {ATTACH DATABASE '/tmp/tmp.fzTqappNuh/%}


Steps to reproduce:

    fossil init repository
    cd /tmp/tmp.fzTqappNuh/%DIR
    fossil open ../repository #or somewhere else

The error occurs. The expected behaviour is that a directory could
contain all characters -- even a '%'.

Best regards,
Pararaum

(2) By Stephan Beal (stephan) on 2020-03-15 15:24:28 in reply to 1 [link]

> Please advise where to send this bug report to

This is the correct place.

Here's a slightly simpler reproducible case:

```
$ mkdir /tmp/%DIR
$ cd /tmp/%DIR
$ fossil open ~/some-repo.fossil
SQLITE_ERROR(1): unrecognized token: "'/tmp/%" in "ATTACH DATABASE '/tmp/%"
Database error: unrecognized token: "'/tmp/%": {ATTACH DATABASE '/tmp/%}
```

i'm looking into the problem but have not yet identified the culprit.

(3) By Stephan Beal (stephan) on 2020-03-15 15:34:12 in reply to 1

Here's the problem:

<https://fossil-scm.org/fossil/info?udc=1&ln=1289-1296&name=d75f4c685956c943>

That's expanding to:

```
ATTACH DATABASE '/tmp/%DIR/.fslckout' AS 'localdb' KEY ''
```

Which is then being passed to:

```
db_multi_exec(zCmd);
```

which is then treating `zCmd` as formatted input. The fix is now clear - it will be in trunk shortly.