PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: yuin/gopher-lua (go)
Issue: fread/fclose different behavior
* GopherLua version : 2b3f02d9173010b12bb3ff2c0e758921accb4096
* go version go1.21.1 linux/amd64
* Linux 6.5.4-gentoo-x86_64

code:
```lua
file = "/tmp"                                                                            
fd, _, code = io.open(file, "r")                                                          
_, _, ecode = fd:read(1)                                                                  
print(ecode) 
```

Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio:
```sh
$ lua ~/tmp/f.lua
21
```
Gopher-lua:
   ⨯ extra/wrapper.lua:17: read /tmp: is a directory
stack traceback:
	[G]: in function 'read'
	extra/wrapper.lua:17: in function 'exec'
	<string>:1: in main chunk
	[G]: ?

Lua works fine, gopher lua throws an exception.
Pull request description: iolib: fix different behavior in read function
$ lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> file = "/tmp"
> fd, _, code = io.open(file, "r")
> _, _, ecode = fd:read(1)
> print(ecode)
21
>

gopher-lua throws an exception:
        read /tmp: is a directory
stack traceback:
        [G]: in function 'read'
        extra/wrapper.lua:17: in function 'exec'
        <string>:1: in main chunk
        [G]: ?

This patch results in behavior similar to the vanilla lua implementation.

Closes #455


Patch:
diff --git a/iolib.go b/iolib.go
index 3f5f295..781b18f 100644
--- a/iolib.go
+++ b/iolib.go
@@ -404,10 +404,10 @@ normalreturn:
 	return L.GetTop() - top
 
 errreturn:
-	L.RaiseError(err.Error())
-	//L.Push(LNil)
-	//L.Push(LString(err.Error()))
-	return 2
+	L.Push(LNil)
+	L.Push(LString(err.Error()))
+	L.Push(LNumber(1)) // C-Lua compatibility: Original Lua pushes errno to the stack
+	return 3
 }
 
 var fileSeekOptions = []string{"set", "cur", "end"}


Test patch:
diff --git a/_glua-tests/issues.lua b/_glua-tests/issues.lua
index 65a2c7f..6d6343a 100644
--- a/_glua-tests/issues.lua
+++ b/_glua-tests/issues.lua
@@ -470,6 +470,16 @@ function test()
 end
 test()
 
+-- issue #455
+function test()
+  local path = "."
+  local fd, _, code = io.open(path, "r")
+  assert(fd ~= nil)
+  local _, _, ecode = fd:read(1)
+  assert(ecode == 1)
+end
+test()
+
 -- issue #459
 function test()
   local a, b = io.popen("ls", nil)
Repository: sindresorhus/query-string (js)
Issue: parse with option `parseNumbers: true` cause unexpected behavior
When an incomplete param are passed like `search=` the result is unexpected.

*case*
```js
const queryString = require('query-string'); // 6.8.1
const queryObject = queryString.parse('search=', { parseNumbers: true });
console.log(queryObject);
```

*received result*
```js
{ search: 0 }
```


*expected result*
```js
{ search: '' }; // or
{ }
```

Pull request description: Ensure empty string & spaces are parsed as string when `parseNumber: true`
fix #194 

Patch:
diff --git a/index.js b/index.js
index da459c9..35c13e1 100644
--- a/index.js
+++ b/index.js
@@ -202,7 +202,7 @@ function parse(input, options) {
 		// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
 		value = value === undefined ? null : decode(value, options);
 
-		if (options.parseNumbers && !Number.isNaN(Number(value))) {
+		if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
 			value = Number(value);
 		} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
 			value = value.toLowerCase() === 'true';


Test patch:
diff --git a/test/parse.js b/test/parse.js
index 9ae2dc6..8273b71 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -243,6 +243,7 @@ test('NaN value returns as string if option is set', t => {
 	t.deepEqual(queryString.parse('foo=null', {parseNumbers: true}), {foo: 'null'});
 	t.deepEqual(queryString.parse('foo=undefined', {parseNumbers: true}), {foo: 'undefined'});
 	t.deepEqual(queryString.parse('foo=100a&bar=100', {parseNumbers: true}), {foo: '100a', bar: 100});
+	t.deepEqual(queryString.parse('foo=   &bar=', {parseNumbers: true}), {foo: '   ', bar: ''});
 });
 
 test('boolean value returns as string by default', t => {
Repository: benhoyt/goawk (go)
Issue: Allow line break between `}` and `while`
See:
```
$ goawk 'BEGIN{do{}
while(0)}'
<cmdline>:1:11: expected while instead of <newline>
BEGIN{do{}
          ^
$
```
POSIX allows line breaks after every closing brace, the one terminating a `do` group is no exception.
Pull request description: Allow optional newline between "do {}" and "while"
Fixes #219. Thanks @oguz-ismail for the report.

Patch:
diff --git a/parser/parser.go b/parser/parser.go
index 33b1e5f..c5db54a 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -379,6 +379,7 @@ func (p *parser) stmt() ast.Stmt {
 		p.next()
 		p.optionalNewlines()
 		body := p.loopStmts()
+		p.optionalNewlines()
 		p.expect(WHILE)
 		p.expect(LPAREN)
 		cond := p.expr()


Test patch:
diff --git a/interp/interp_test.go b/interp/interp_test.go
index a2208b9..630aff0 100644
--- a/interp/interp_test.go
+++ b/interp/interp_test.go
@@ -155,6 +155,7 @@ NR==3, NR==5 { print NR }
 	{`BEGIN { s="x"; while (s=="x") { print s; s="y" } }`, "", "x\n", "", ""},
 	{`BEGIN { s="x"; while (s!="") { print s; s="" } }`, "", "x\n", "", ""},
 	{`BEGIN { s="x"; while (s) { print s; s="" } }`, "", "x\n", "", ""},
+	{"BEGIN { do { print 1 }\nwhile (0) }", "", "1\n", "", ""},
 	// regression tests for break and continue with nested loops
 	{`
 BEGIN {