pike issueshttps://git.lysator.liu.se/pikelang/pike/-/issues2023-11-16T12:02:24Zhttps://git.lysator.liu.se/pikelang/pike/-/issues/10136Private getter not marked as used.2023-11-16T12:02:24ZHenrik (Grubba) GrubbströmPrivate getter not marked as used.Reported by Pontus Östlund:
```
$ cat bug-private-getter.pike
class Test {
private string `property_accessor() {
return "I'm private";
}
private string `unused_getter() {
return "Unused private getter";
}
public void...Reported by Pontus Östlund:
```
$ cat bug-private-getter.pike
class Test {
private string `property_accessor() {
return "I'm private";
}
private string `unused_getter() {
return "Unused private getter";
}
public void log() {
werror("Log: %s\n", property_accessor);
}
}
int main() {
Test t = Test();
t->log();
}
```
In current Pike 8.0:
```
$ ./pike bug-private-getter.pike
bug-private-getter.pike:2: Warning: Modifier mismatch for variable property_accessor.
bug-private-getter.pike:6: Warning: Modifier mismatch for variable unused_getter.
bug-private-getter.pike:13: Warning: `property_accessor is private but not used anywhere.
bug-private-getter.pike:13: Warning: unused_getter is private but not used anywhere.
bug-private-getter.pike:13: Warning: `unused_getter is private but not used anywhere.
Log: I'm private
```
In current Pike master:
```
$ ./pike bug-private-getter.pike
bug-private-getter.pike:13: Warning: `property_accessor is private but not used anywhere.
bug-private-getter.pike:13: Warning: unused_getter is private but not used anywhere.
bug-private-getter.pike:13: Warning: `unused_getter is private but not used anywhere.
Log: I'm private
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10125Consider using a mapping lookup in F_SWITCH when case ranges are not in use.2023-06-28T13:06:04ZHenrik (Grubba) GrubbströmConsider using a mapping lookup in F_SWITCH when case ranges are not in use.`array.c:switch_lookup()` currently uses binary search to perform the lookup. In the common case where no `F_CASE_RANGE`s are used it would be possible to just use a mapping lookup instead.
This would require a slight API change for `sw...`array.c:switch_lookup()` currently uses binary search to perform the lookup. In the common case where no `F_CASE_RANGE`s are used it would be possible to just use a mapping lookup instead.
This would require a slight API change for `switch_lookup()` in that the first argument would need to be a `struct svalue *` (instead of the current `struct array *`).Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10118Support "cwd" and "chroot" being Stdio.File objects in Process.create_process...2023-05-14T07:54:14ZHenrik (Grubba) GrubbströmSupport "cwd" and "chroot" being Stdio.File objects in Process.create_process() et al on plaforms that have fchdir(2).It would be useful to be able to avoid filesystem-races in `Process.create_process()` by having it support stuff like:
```
Stdio.File dirfd = Stdio.File(some_workdir, "r");
...
Process.Process proc = Process.Process(({ "some", "com...It would be useful to be able to avoid filesystem-races in `Process.create_process()` by having it support stuff like:
```
Stdio.File dirfd = Stdio.File(some_workdir, "r");
...
Process.Process proc = Process.Process(({ "some", "command" }), ([ "cwd": dirfd ]));
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10119Add Stdio.File()->cd() on platforms that have fchdir(2)2023-05-13T11:24:14ZHenrik (Grubba) GrubbströmAdd Stdio.File()->cd() on platforms that have fchdir(2)Example:
```
Stdio.File dir_fd = Stdio.File(some_dir, "r");
dir_fd->cd(); // cd(some_dir);
dir_fd->cd("foo"); // cd(combine_path(some_dir, "foo"));
```Example:
```
Stdio.File dir_fd = Stdio.File(some_dir, "r");
dir_fd->cd(); // cd(some_dir);
dir_fd->cd("foo"); // cd(combine_path(some_dir, "foo"));
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10113Add API(s) for converting pike (wide-) strings to NUL-terminated UTF16-strings.2023-05-06T10:37:09ZHenrik (Grubba) GrubbströmAdd API(s) for converting pike (wide-) strings to NUL-terminated UTF16-strings.Currently this is achieved via calling of `string_to_unicode(..., 2)` and having a special case that ensures that all byte-strings of even length have a double NUL-termination.
Eg:
```
get_all_args(NULL, args, "%t%T%T.%d%d",
...Currently this is achieved via calling of `string_to_unicode(..., 2)` and having a special case that ensures that all byte-strings of even length have a double NUL-termination.
Eg:
```
get_all_args(NULL, args, "%t%T%T.%d%d",
&username_str, &domain_str, &pw_str,
&logontype, &logonprovider);
ref_push_string(username_str);
push_int(2);
f_string_to_unicode(2);
username = (LPCWSTR)STR0(sp[-1].u.string);
args++;
if (domain_str) {
ref_push_string(domain_str);
push_int(2);
f_string_to_unicode(2);
domain = (LPCWSTR)STR0(sp[-1].u.string);
args++;
}
```
It would be nice to have:
* A function for converting a `struct pike_string *` to a `malloc()`ed NUL-terminated UTF16 `p_wchar *` (eg analogous to `fdlib.c:pike_dwim_utf8_to_utf16()`).
* A format (`%W`?) for `get_args()`/`get_all_args()` that returns the above.Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10105Update various WIN32-API functions to be wide-string aware.2023-05-04T11:02:59ZHenrik (Grubba) GrubbströmUpdate various WIN32-API functions to be wide-string aware.Several NT API functions in Pike currently use the `*A` variants rather than the `*W` variants of functions. Eg `_system.LookupAccountName()` uses `LookupAccountNameA()` rather than `LookupAccountNameW()`.
Non-exhaustive list of used NT...Several NT API functions in Pike currently use the `*A` variants rather than the `*W` variants of functions. Eg `_system.LookupAccountName()` uses `LookupAccountNameA()` rather than `LookupAccountNameW()`.
Non-exhaustive list of used NT functions:
* [x] `AcquireCredentialsHandleA`
* [~] `CreateFileA`
* [x] `ExpandEnvironmentStringsA`
* [x] `GetNamedSecurityInfoA`
* [~] `InetNtopA`
* [x] `LogonUserA`
* [x] `LookupAccountNameA`
* [x] `LookupAccountSidA`
* [x] `MoveFileExA`
* [x] `QueryContextAttributesA`
* [~] `QueryDosDeviceA`
* [x] `QuerySecurityPackageInfoA`
* [x] `RegEnumKeyExA`
* [x] `RegEnumValueA`
* [x] `RegOpenKeyExA`
* [x] `RegQueryValueExA`
* [x] `SetNamedSecurityInfoA`
Update the code to be wide-string aware.
**NB**: Some of the above are currently accessed via aliases that look at `UNICODE` (and thus do not have an explicit `A`-suffix in the code).Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10117System.RegGetValue{,s} does not handle DWORD entries correctly.2023-05-03T09:33:46ZHenrik (Grubba) GrubbströmSystem.RegGetValue{,s} does not handle DWORD entries correctly.`src/modules/system/nt.c:push_regvalue()` uses the wrong shifts for bytes other than the LSB:
```
case REG_DWORD_LITTLE_ENDIAN:
push_int(EXTRACT_UCHAR(buffer)+
(EXTRACT_UCHAR(buffer+1)<<1)+
(EXTRAC...`src/modules/system/nt.c:push_regvalue()` uses the wrong shifts for bytes other than the LSB:
```
case REG_DWORD_LITTLE_ENDIAN:
push_int(EXTRACT_UCHAR(buffer)+
(EXTRACT_UCHAR(buffer+1)<<1)+
(EXTRACT_UCHAR(buffer+2)<<2)+
(EXTRACT_UCHAR(buffer+3)<<3));
break;
case REG_DWORD_BIG_ENDIAN:
push_int(EXTRACT_UCHAR(buffer+3)+
(EXTRACT_UCHAR(buffer+2)<<1)+
(EXTRACT_UCHAR(buffer+1)<<2)+
(EXTRACT_UCHAR(buffer)<<3));
break;
```
Fortunately it seems like the most common DWORD entries in the registry are <= 255.
This bug has been there since the original implementation of `System.RegGetValues()` et al in commit 53bdc644af4c8f3def29230b0dc38b7640561708 (`src/modules/system/nt.c:1.18`) in Pike 7.1.5.
Note that the bug is also present in Pike 7.0.318 and later due to a backport in commit 9481e19ee7753e06292231699f04c21841a2b6a1 (`src/modules/system/nt.c:1.19`).
The bug should be fixed in all relevant versions of Pike.Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10109Add support for defining macros with arguments with -DFOO(X)=X.2023-04-19T09:59:51ZHenrik (Grubba) GrubbströmAdd support for defining macros with arguments with -DFOO(X)=X.This would be useful for eg:
```
$ ./pike '-D_refs(X)=3' .../some/old/version/socktest.pike
```
Currently only `-DFOO=3` and `-DFOO()=3` are supported. Note that the syntax `-DFOO(X)=X` is accepted, but defines a macro with the name `FO...This would be useful for eg:
```
$ ./pike '-D_refs(X)=3' .../some/old/version/socktest.pike
```
Currently only `-DFOO=3` and `-DFOO()=3` are supported. Note that the syntax `-DFOO(X)=X` is accepted, but defines a macro with the name `FOO(X)`...
The reasonable place to implement this is `cpp.cmod:add_define()`.Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10099Support nested multi-assign2023-02-18T09:53:03ZTobias S. JosefowitzSupport nested multi-assignSupport `[int a, [int b, int c], int d] = ({ 1, ({ 2, 3 }), 4 });`Support `[int a, [int b, int c], int d] = ({ 1, ({ 2, 3 }), 4 });`Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10086Add syntax for specifying default values for optional arguments.2022-10-20T08:48:14ZHenrik (Grubba) GrubbströmAdd syntax for specifying default values for optional arguments.Suggested:
```
string foo(string bar = "default")
{
return bar;
}
// typeof(foo) ==> function(string|void: string)
// typeof(bar) ==> string
// foo() ==> "default"
// foo(UNDEFINED) ==> "default"
// foo("foo") ==> "foo"
```Suggested:
```
string foo(string bar = "default")
{
return bar;
}
// typeof(foo) ==> function(string|void: string)
// typeof(bar) ==> string
// foo() ==> "default"
// foo(UNDEFINED) ==> "default"
// foo("foo") ==> "foo"
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/7828Loop documentation contains inappropriate examples2022-08-28T14:56:44ZPeter BortasLoop documentation contains inappropriate examplesImported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7828
Reference: http://pike.lysator.liu.se/docs/tutorial/statements/loops.xml
Reported by Daniel Wressle <wressle@roxen.com>
At http://pike.lysator.liu.se/docs/tutorial/...Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7828
Reference: http://pike.lysator.liu.se/docs/tutorial/statements/loops.xml
Reported by Daniel Wressle <wressle@roxen.com>
At http://pike.lysator.liu.se/docs/tutorial/statements/loops.xml there is an example code snippet which reads as follows:
```
string answer;
write("Have you stopped beating your wife yet?\n");
do
{
write("Answer yes or no: ");
answer = Stdio.stdin->gets();
} while(answer != "yes" && answer != "no");
```
I don't think further comments are necessary. Alter or remove.Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10062Add support for Autoconf 2.712022-08-28T11:31:16ZHenrik (Grubba) GrubbströmAdd support for Autoconf 2.71Autoconf 2.71 was released recently and is incompatible with Pike.
Fix the issues.Autoconf 2.71 was released recently and is incompatible with Pike.
Fix the issues.Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10029CID 1461176: Null pointer dereferences (FORWARD_NULL)2020-04-05T12:44:28ZHenrik (Grubba) GrubbströmCID 1461176: Null pointer dereferences (FORWARD_NULL)```
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3033 in do_code_block()
________________________________________________________________________________________________________
*** CID 1461176: Null pointer dereferences (FOR...```
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3033 in do_code_block()
________________________________________________________________________________________________________
*** CID 1461176: Null pointer dereferences (FORWARD_NULL)
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3033 in do_code_block()
3027
3028 init_bytecode();
3029 label_no=1;
3030 PUSH_STATEMENT_LABEL;
3031 save_label = current_label->prev;
3032 current_label->prev = NULL;
>>> CID 1461176: Null pointer dereferences (FORWARD_NULL)
>>> Dereferencing null pointer "current_label->prev".
3033 PUSH_CLEANUP_FRAME(NULL, NULL);
3034 current_stack_depth = 0;
3035
3036 /* NOTE: This is no ordinary label... */
3037 low_insert_label(0);
3038 emit0(F_ENTRY);
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10028CID 1461177: Null pointer dereferences (FORWARD_NULL)2020-04-05T12:44:28ZHenrik (Grubba) GrubbströmCID 1461177: Null pointer dereferences (FORWARD_NULL)```
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3274 in docode()
________________________________________________________________________________________________________
*** CID 1461177: Null pointer dereferences (FORWARD_NU...```
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3274 in docode()
________________________________________________________________________________________________________
*** CID 1461177: Null pointer dereferences (FORWARD_NULL)
/home/covbuilder/pike/Pike-v8.1-snapshot/src/docode.c: 3274 in docode()
3268 struct byte_buffer instrbuf_save = instrbuf;
3269 struct statement_label *label_save;
3270
3271 PUSH_STATEMENT_LABEL;
3272 label_save = current_label->prev;
3273 current_label->prev = NULL;
>>> CID 1461177: Null pointer dereferences (FORWARD_NULL)
>>> Dereferencing null pointer "current_label->prev".
3274 PUSH_CLEANUP_FRAME(NULL, NULL);
3275 label_no=1;
3276 current_stack_depth = 0;
3277 Pike_compiler->compiler_frame->generator_local = -1;
3278 init_bytecode();
3279
```Pike Nexthttps://git.lysator.liu.se/pikelang/pike/-/issues/10027Standards.JSON5.encode() can stall a multi-threaded process for quite a while2020-03-31T09:56:10ZHenrik (Grubba) GrubbströmStandards.JSON5.encode() can stall a multi-threaded process for quite a whileCf #10026, but replace JSON with JSON5.Cf #10026, but replace JSON with JSON5.Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbströmhttps://git.lysator.liu.se/pikelang/pike/-/issues/10023Optimizer fatal error "F_PUSH_ARRAY unexpected in this context."2020-03-29T12:26:33ZHenrik (Grubba) GrubbströmOptimizer fatal error "F_PUSH_ARRAY unexpected in this context."Triggered by the MirarDoc image extractor.
It seems to be due to running `eval()` on an `F_ARG_LIST`-node which in turn contains an `F_PUSH_ARRAY`-node.Triggered by the MirarDoc image extractor.
It seems to be due to running `eval()` on an `F_ARG_LIST`-node which in turn contains an `F_PUSH_ARRAY`-node.Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbströmhttps://git.lysator.liu.se/pikelang/pike/-/issues/10021multiset | UNDEFINED ought to be a supported operation.2020-03-21T15:45:19ZHenrik (Grubba) Grubbströmmultiset | UNDEFINED ought to be a supported operation.Consider
```
mapping(string:multiset(string)) attributes = ([]);
void add_attributes(string key, multiset(string) attrs)
{
attributes[key] = attributes[key] || (<>); // Init.
attributes[key] |= attrs;
}
```
Having `UNDEFINED | multi...Consider
```
mapping(string:multiset(string)) attributes = ([]);
void add_attributes(string key, multiset(string) attrs)
{
attributes[key] = attributes[key] || (<>); // Init.
attributes[key] |= attrs;
}
```
Having `UNDEFINED | multiset` behave as `(<>) | multiset` would remove the need for the initialization.Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbströmhttps://git.lysator.liu.se/pikelang/pike/-/issues/10012Several autodoc typos in Standards.X509.2020-03-20T10:40:09ZHenrik (Grubba) GrubbströmSeveral autodoc typos in Standards.X509.`failes` ==> `fails`
`it's child` ==> `its child`
Pike 8.0 only:
`oredered` ==> `ordered`
`srevers` ==> `servers`
Also: Is the lack of strict mode for `verify_certificate_chain()` in Pike master intentional?`failes` ==> `fails`
`it's child` ==> `its child`
Pike 8.0 only:
`oredered` ==> `ordered`
`srevers` ==> `servers`
Also: Is the lack of strict mode for `verify_certificate_chain()` in Pike master intentional?Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbströmhttps://git.lysator.liu.se/pikelang/pike/-/issues/10018Typechecking errors with large integers and sprintf("%c").2020-03-15T11:16:09ZHenrik (Grubba) GrubbströmTypechecking errors with large integers and sprintf("%c").The testsuite currently fails with:
```
Doing tests in testsuite (12091 tests, pid 29825)
Fri Mar 13 16:28:53 2020: Thread.Thread(0x7fced9367700) at 900
testsuite:2: Soft cast of string(1: -1412597613) to string(2147483647) isn't a valid...The testsuite currently fails with:
```
Doing tests in testsuite (12091 tests, pid 29825)
Fri Mar 13 16:28:53 2020: Thread.Thread(0x7fced9367700) at 900
testsuite:2: Soft cast of string(1: -1412597613) to string(2147483647) isn't a valid cast.
testsuite:2: Expected: string(2147483647).
testsuite:2: Got : string(1: -1412597613).
/lhome/build/Xenofarm/client/pike-devel/medaka.roxen.com/buildtmp/Pike-v8.1-snapshot/src/testsuite.in:14918: Test 11817 (CRNL) failed.
1: mixed a() { return "\25363274223"; }
2: mixed b() { return sprintf("%c", 0x1abcd7893) ; }
testsuite:2: Soft cast of string(1: 1412597613) to string(-2147483648) isn't a valid cast.
testsuite:2: Expected: string(-2147483648).
testsuite:2: Got : string(1: 1412597613).
/lhome/build/Xenofarm/client/pike-devel/medaka.roxen.com/buildtmp/Pike-v8.1-snapshot/src/testsuite.in:14919: Test 11818 (shift 1) (CRNL) failed.
1: mixed a() { return "\12414503555"; }
2: mixed b() { return sprintf("%c", -0x1abcd7893) ; }
Subresult: 41609 tests, 2 failed, 13 skipped
```
The cause is that the values `025363274223`, `0x1abcd7893`, `012414503555` and `-0x1abcd7893` all are out of the 32-bit signed range of the integer type.
The easiest fix is probably just to switch the type for large integers to the generic `int` type.Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbströmhttps://git.lysator.liu.se/pikelang/pike/-/issues/10017Compiler: The multi assign treeopt fix was broken.2020-03-12T15:28:53ZHenrik (Grubba) GrubbströmCompiler: The multi assign treeopt fix was broken.The fix for #10006 causes warnings in Nettle:
```
Pike v8.1 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
> Nettle.Hash;
/home/grubba/src/Pike/8.1/lib/modules/__builtin.pmod/Nettle.pmod/Hash.pike:1280: Warning: An expression...The fix for #10006 causes warnings in Nettle:
```
Pike v8.1 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
> Nettle.Hash;
/home/grubba/src/Pike/8.1/lib/modules/__builtin.pmod/Nettle.pmod/Hash.pike:1280: Warning: An expression of type array(int | string) cannot be assigned to a variable of type array(int | string(8bit)).
/home/grubba/src/Pike/8.1/lib/modules/__builtin.pmod/Nettle.pmod/Hash.pike:1281: Warning: Expected: array(int | string(8bit)).
/home/grubba/src/Pike/8.1/lib/modules/__builtin.pmod/Nettle.pmod/Hash.pike:1281: Warning: Got : array(int | string).
```
The code that is warned about:
```
if (!catch([r, salt, iters] = [array(string(8bit)|int)]
array_sscanf(line, format))
```Pike NextHenrik (Grubba) GrubbströmHenrik (Grubba) Grubbström