Fossil SCM
Improvements to escaping of filenames that are passed down into subprocesses on Windows.
Commit
fc0b9325f02b16b3832e37365e2d9e66ab373663d168c05e72c6aa92a508f68a
Parent
8ed9fdd56556107…
1 file changed
+3
-1
+3
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -1575,11 +1575,11 @@ | ||
| 1575 | 1575 | ** 5 First byte of a 4-byte UTF-8 |
| 1576 | 1576 | */ |
| 1577 | 1577 | static const char aSafeChar[256] = { |
| 1578 | 1578 | #ifdef _WIN32 |
| 1579 | 1579 | /* Windows |
| 1580 | -** Prohibit: all control characters, including tab, \r and \n | |
| 1580 | +** Prohibit: all control characters, including tab, \r and \n. Also % | |
| 1581 | 1581 | ** Escape: (space) " # $ % & ' ( ) * ; < > ? [ ] ^ ` { | } |
| 1582 | 1582 | */ |
| 1583 | 1583 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1584 | 1584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1585 | 1585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| @@ -1700,10 +1700,12 @@ | ||
| 1700 | 1700 | blob_append_char(pBlob, '.'); |
| 1701 | 1701 | } |
| 1702 | 1702 | for(i=0; (c = (unsigned char)zIn[i])!=0; i++){ |
| 1703 | 1703 | blob_append_char(pBlob, (char)c); |
| 1704 | 1704 | if( c=='"' ) blob_append_char(pBlob, '"'); |
| 1705 | + if( c=='\\' ) blob_append_char(pBlob, '\\'); | |
| 1706 | + if( c=='%' ) blob_append(pBlob, "%cd:~,%", 7); | |
| 1705 | 1707 | } |
| 1706 | 1708 | blob_append_char(pBlob, '"'); |
| 1707 | 1709 | #else |
| 1708 | 1710 | /* Quoting strategy for unix: |
| 1709 | 1711 | ** If the name does not contain ', then surround the whole thing |
| 1710 | 1712 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1575,11 +1575,11 @@ | |
| 1575 | ** 5 First byte of a 4-byte UTF-8 |
| 1576 | */ |
| 1577 | static const char aSafeChar[256] = { |
| 1578 | #ifdef _WIN32 |
| 1579 | /* Windows |
| 1580 | ** Prohibit: all control characters, including tab, \r and \n |
| 1581 | ** Escape: (space) " # $ % & ' ( ) * ; < > ? [ ] ^ ` { | } |
| 1582 | */ |
| 1583 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| @@ -1700,10 +1700,12 @@ | |
| 1700 | blob_append_char(pBlob, '.'); |
| 1701 | } |
| 1702 | for(i=0; (c = (unsigned char)zIn[i])!=0; i++){ |
| 1703 | blob_append_char(pBlob, (char)c); |
| 1704 | if( c=='"' ) blob_append_char(pBlob, '"'); |
| 1705 | } |
| 1706 | blob_append_char(pBlob, '"'); |
| 1707 | #else |
| 1708 | /* Quoting strategy for unix: |
| 1709 | ** If the name does not contain ', then surround the whole thing |
| 1710 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1575,11 +1575,11 @@ | |
| 1575 | ** 5 First byte of a 4-byte UTF-8 |
| 1576 | */ |
| 1577 | static const char aSafeChar[256] = { |
| 1578 | #ifdef _WIN32 |
| 1579 | /* Windows |
| 1580 | ** Prohibit: all control characters, including tab, \r and \n. Also % |
| 1581 | ** Escape: (space) " # $ % & ' ( ) * ; < > ? [ ] ^ ` { | } |
| 1582 | */ |
| 1583 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| @@ -1700,10 +1700,12 @@ | |
| 1700 | blob_append_char(pBlob, '.'); |
| 1701 | } |
| 1702 | for(i=0; (c = (unsigned char)zIn[i])!=0; i++){ |
| 1703 | blob_append_char(pBlob, (char)c); |
| 1704 | if( c=='"' ) blob_append_char(pBlob, '"'); |
| 1705 | if( c=='\\' ) blob_append_char(pBlob, '\\'); |
| 1706 | if( c=='%' ) blob_append(pBlob, "%cd:~,%", 7); |
| 1707 | } |
| 1708 | blob_append_char(pBlob, '"'); |
| 1709 | #else |
| 1710 | /* Quoting strategy for unix: |
| 1711 | ** If the name does not contain ', then surround the whole thing |
| 1712 |