sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: rust
Issue: File::open() on directories does not return Err(), leads to breakage with BufReader
Labels: C-enhancement,T-libs-api,A-docs,A-io

I tripped onto some odd behaviour.

I was under the assumption calling `File::open()` on a directory would Err(), and that I could use that to handle a user specifying a path that was not a file, ( instead of falling prey to race conditions by stat-ing first and then opening second ).

However, ... bad things happened instead.

```rust
use std::path::PathBuf;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;

fn main() {
    let file = File::open(PathBuf::from("/tmp")).unwrap();
    let buf  = BufReader::with_capacity(100, file);
    let _lines: Vec<std::io::Result<String>> = buf.lines().collect();
}
```

The last of these lines will run forever, with strace reporting:
```
read(3, 0x564803253b80, 100)            = -1 EISDIR (Is a directory)
```
Over and over again ad-infinitum with no end in sight.

Somehow I had a variation of this go crazy and eat 200% of my ram, but I'm having a hard time reproducing that exact case (Though it may have been related to the target-directory in question also being massive in my case).

Digging shows related bug #43504

The profound question that remains unanswered is: "Why is calling File::open on a directory fine?" 

And the residual question is "How does one invoke File::open in such a way that it refuses to work on directories".

And importantly, how do I achieve that portably?

And if none of these concerns can be mitigated, the very least that could be done is have this giant foot-gun documented somewhere in `File::open`.

( As far as I can divine, there's no useful behaviour to be found by allowing File::open to work on directories, as standard read() semantics simply don't work on directory filehandles, you have to use readdir() )
Repository: pytorch
Issue: libtorch forward memory leak
Labels: module: cpp,module: memory usage,triaged

when I input arbitrary size to my network, the memory will increase all the time。but when i fix my input on 224 * 224, the memory will not increase! 
I have tried export my network using torch.jit.script and torch.jit.trace. this problem always exist !
by the way, I use libtorch1.1

cc @yf225
Repository: pytorch
Issue: Torch.jit.trace unexpected error with `torch.cat(…, dim=-1)` 
Labels: oncall: jit,triaged

Find below a Minimum Reproducible Example that crashes both in Pytorch 1.1 and Pytorch 1.2 with CUDA (it works with CPU).

```
import torch 
from torch import nn

device = torch.device('cuda') # crashes with cuda, works with cpu

class Model(nn.Module):

    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(2, 16)
        self.linear2 = nn.Linear(2, 16)

    def forward(self, x, y):
        x = self.linear1(x)
        y = self.linear2(y)
        return torch.cat([x, y], dim=-1) # if we replace -1 with 1 works fine with either GPU or CPU

model = Model().to(device)

data = [torch.randn(1, 2).to(device), torch.randn(1, 2).to(device)] 

traced = torch.jit.trace(model, data)

print(traced)
```

Surprisingly the above works with CPU backend but not with CUDA backend. It also works when `torch.cat(..., dim=1)` but crashes with a negative dimension referring to the same one `torch.cat(..., dim=-1)`.

Find the jit.trace error below (not very explanatory):
```
torch.jit.TracingCheckError: Tracing failed sanity checks!
Encountered an exception while running the trace with test inputs.
Exception:
        vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 2)
        The above operation failed in interpreter, with the following stack trace:

                               
```

cc @suo
Repository: go
Issue: net/http: on CheckRedirect failure, error message should refer to the original (redirected) URL, not the rejected redirect
Labels: NeedsInvestigation

### What version of Go are you using (`go version`)?

<pre>
example.com$ go1.13 version
go version go1.13 linux/amd64
</pre>

### Does this issue reproduce with the latest release?

Yes.


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
example.com$ go1.13 env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bcmills/.cache/go-build"
GOENV="/usr/local/google/home/bcmills/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/tmp/tmp.V4fL5k5JdS/_gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/google/home/bcmills/sdk/go1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/bcmills/sdk/go1.13/pkg/tool/linux_amd64"
GCCGO="/usr/local/google/home/bcmills/bin/gccgo"
AR="ar"
CC="gcc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/tmp/tmp.V4fL5k5JdS/example.com/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build400745746=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

Ran the program found at https://play.golang.org/p/42egMHzeuTR.

<details>

```
example.com$ cat >./main.go <<EOF
package main

import (
	"fmt"
	"net/http"
)

var securityPreservingHTTPClient = &http.Client{
	CheckRedirect: func(req *http.Request, via []*http.Request) error {
		if len(via) > 0 && via[0].URL.Scheme == "https" && req.URL.Scheme != "https" {
			lastHop := via[len(via)-1].URL
			return fmt.Errorf("redirected from secure URL %s to insecure URL %s", lastHop, req.URL)
		}
		return nil
	},
}

func main() {
	_, err := securityPreservingHTTPClient.Get("https://vcs-test.golang.org/insecure/go/insecure")
	fmt.Println(err)
}
EOF

example.com$ cat >./go.mod <<EOF
module example.com

go 1.13
EOF

example.com$ go1.13 run .
```

</details>

### What did you expect to see?

```
Get "https://vcs-test.golang.org/insecure/go/insecure": redirected from secure URL https://vcs-test.golang.org/insecure/go/insecure to insecure URL http://vcs-test.golang.org/go/insecure
```

Since the `http.Client` should not have attempted to fetch the insecure URL in the first place, the insecure URL should not be the one reported for the failed `Get` operation.

### What did you see instead?

```
Get "http://vcs-test.golang.org/go/insecure": redirected from secure URL https://vcs-test.golang.org/insecure/go/insecure to insecure URL http://vcs-test.golang.org/go/insecure
```

The URL that follows the `Get` token is one for which no HTTP `GET` was actually attempted.

CC @bradfitz
Repository: material-ui
Issue: Errors when dynamically importing components
Labels: new feature,performance

<!--
  Thank you very much for contributing to Material-UI by creating an issue! ❤️
  To avoid duplicate issues we ask you to check off the following list.
-->

<!-- Checked checkbox should look like this: [x] -->

- [x] The issue is present in the latest release.
- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.

## Current Behavior 😯

When doing a dynamic import with an expression that can only be evaluated at run-time (e.g. `import('@material-ui/core/' + window.buttonComponentName)`), there are a bunch of errors, e.g. (just to list one of them):

> Error: Can't resolve './props' in '/Users/mbrowne/_temp/react-webpack-error-template/node_modules/@material-ui/core/styles'

Interestingly, in my demo repo, the button actually still renders despite the errors, but you can't do a production build.

## Expected Behavior 🤔

Dynamic imports should work without errors

## Steps to Reproduce 🕹

Clone the `material-ui-dynamic-imports` branch of my [demo repo](https://github.com/mbrowne/react-webpack-error-template/tree/material-ui-dynamic-imports):
`git clone git@github.com:mbrowne/react-webpack-error-template.git --single-branch --branch material-ui-dynamic-imports`.

Run `yarn start` and you'll see the compile errors (both at the command line and in the browser console).

## Context 🔦

A practical use case for doing this would be receiving the name/ID of which component to use for rendering something from an API response, so that the import would really need to be fully dynamic. `window.buttonComponentName` (if set elsewhere, e.g. in index.html) mimics such a fully dynamic import.

## Details

The errors are probably at least partially due to issues with webpack. I tried a very simple test module with a fake Button component (instead of material-ui), and I was still getting warnings and errors as soon as I introduced `.d.ts` files, even if I removed the `typings` entry from the `package.json` of the test module. It seems that fully dynamic imports cause webpack to scan the entire package being imported (at build time) no matter what, including `.d.ts` files.

So as an experiment, I tried removing all the `.d.ts` files and many of the errors went away. There were some remaining errors related to `test-utils`, so I tried deleting `test-utils`, `es/test-utils`, and `esm/test-utils`, and those errors went away too. Afterwards there were only a couple warnings left—"unexpected character" and "unexpected token"s in the markdown files and the LICENSE file, which obviously aren't JS files.

I'm not sure what, if anything, that material-ui can do about all of this, since clearly webpack is doing something odd here, but I wanted to report it so you all are aware.

## Your Environment 🌎

| Tech        | Version |
| ----------- | ------- |
| Material-UI | v4.4.0  |
| React       |    16.9.0     |
| Browser     |   Chrome 76    |
| Webpack     | 4.39.3   |
Repository: flutter
Issue: Better handling of malformed yaml for plugins
Labels: team,c: crash,tool,a: quality,P2,team-tool,triaged-tool

https://github.com/flutter/flutter/pull/38632 added support for adding/extracting new information about plugins in a yaml file, but the validation of the yaml needs improvement. See my comments on the PR for details.

Failing to improve the validation will lead to unhandled exceptions reported to crash logging for problems that only the end-user can address.
Repository: pytorch
Issue: finfo operator not bound into JIT
Labels: oncall: jit,triaged,jit-backlog

## 🐛 Bug

When calling torch.jit.script() on code using torch.finfo, a Runtime Error is generated with:
`Unknown builtin op: aten::finfo.`


## To Reproduce

Steps to reproduce the behavior:

1. Use `torch.finfo(torch.float32).eps` in an expression in a forward() function
1. Tag forward() with `@torch.jit.script`
1. Run model

    class Foo(torch.autograd.Function):
    @torch.jit.script
... in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
RuntimeError: 
Unknown builtin op: aten::finfo.
Here are some suggestions: 
        aten::find

The original call is:
        bar = torch.clamp(bar, min=torch.finfo(torch.float32).eps)
                                                     ~~~~~~~~~~~ <--- HERE
 
## Expected behavior

Model to compile and execute

## Environment
`
PyTorch version: 1.3.0a0+f3f83cc
Is debug build: Yes
CUDA used to build PyTorch: None

OS: CentOS Linux 7 (Core)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
CMake version: version 3.14.0

Python version: 3.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] numpy==1.16.4
[pip] torch==1.3.0a0+f3f83cc
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl-include               2019.4                      243  
[conda] mkl_fft                   1.0.12           py37ha843d7b_0  
[conda] mkl_random                1.0.2            py37hd81dba3_0  
[conda] torch                     1.3.0a0+d806257          pypi_0    pypi
`



cc @suo
Repository: rust
Issue: E0207 when type parameter's associated type is used in `Self`.
Labels: C-enhancement,A-diagnostics,A-associated-items,T-compiler

Not sure if this needs to be an error or not.

Per `rustc --explain E0207`, `impl` type parameter are acceptable if they appear in the `Self` type of the `impl`. Emphasis mine:

>Any type parameter or lifetime parameter of an `impl` must meet at least one of
>the following criteria:
>
>  - **it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`**
>  - for a trait impl, it appears in the _implemented trait_, e.g.
   `impl<T> SomeTrait<T> for Foo`
>  - it is bound as an associated type, e.g. `impl<T, U> SomeTrait for T
   where T: AnotherTrait<AssocType=U>`


Rustc currently generates an error even if an associated type of the parameter appears in the `Self` type: [playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=da0a2f797e01058a852dd82ea70b5e7e):

```rust
trait Field {}

trait Vector {
    type MyField: Field;
}

struct BaseFieldPrinter<F: Field>;

impl<V: Vector> BaseFieldPrinter<V::MyField> {
}
```
It seems like this doesn't need to be an error, but perhaps I'm missing something?
Repository: go
Issue: errors, cmd/vet: too easy to pass a pointer-to-pointer to `errors.As` when it should be a pointer-to-value
Labels: NeedsInvestigation,Analysis

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
pi@raspberrypi:~/temper/go/blort $ go version
go version go1.13 linux/arm
pi@raspberrypi:~/temper/go/blort $
</pre>

### Does this issue reproduce with the latest release?

I am using the latest release.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
pi@raspberrypi:~/temper/go/blort $ go env
GO111MODULE=""
GOARCH="arm"
GOBIN=""
GOCACHE="/home/pi/.cache/go-build"
GOENV="/home/pi/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/pi/temper/go/blort/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build073091018=/tmp/go-build -gno-record-gcc-switches"
pi@raspberrypi:~/temper/go/blort $
</pre></details>

### What did you do?

I've been exploring the new `errors.As()` and wasn't able to get it to recognize a wrapped `syscall.Errno`.  I've distilled a simpler case.  Here is a [playground link](https://play.golang.org/p/eD-97z1XhYO)

```go
package main

import (
	"fmt"
	"syscall"
	"errors"
	"os"
	"reflect"
)

func main() {
	e1 := &os.PathError{Op: "read", Path: "/", Err: errors.New("YIKES")}
	var pe *os.PathError
	if errors.As(e1, &pe) {
		fmt.Println("Found an os.PathError")
	}

	e2 := syscall.Errno(1)
	var se *syscall.Errno
	fmt.Println("Type of e2 is: ", reflect.TypeOf(e2))
	if errors.As(e2, &se) {
		fmt.Println("Found a syscall.Errno")
	}
}
```


### What did you expect to see?

```
Found an os.PathError
Type of e2 is:  syscall.Errno
Found a syscall.Errno
```

### What did you see instead?

```
Found an os.PathError
Type of e2 is:  syscall.Errno
```
Repository: scrcpy
Issue: SendKeys using app, only numbers received in phone
Labels: input events,keyboard

Hi, i'm trying to send string to the android window using application (simple c++);

The strangest thing is... when I send "123abc", in Android text box only received "123"
At first I think this is the problem with the keyboard (I used null keyboard), but after switching to several keyboards.. I believe scrcpy doesn't *fully*  process the input generated by app?

When I typed normally.. no problem,,,, but when the typing is generated by app, only numbers received by phone omitting (a-z). Is this known issue? thanks.
Repository: godot
Issue: KinematicBody still able to move Rigidbodies and VehicleBodies when infinite inertia disabled
Labels: bug,confirmed,topic:physics,topic:3d

___

***Bugsquad edit:** This issue has been confirmed several times already. No need to confirm it further.*

___

**Godot version:** 3.1.1

**OS/device including version:** Ubuntu 19.04

**Issue description:**
According to the documentation, setting infinite inertia to false on a KinematicBody should make so it cannot move RigidBodies. However, when I disable it, I'm still able to move rigidbodies

**Minimal reproduction project:**
WASD movement
space to jump
mouse look
exit to escape

try pushing or jumping on the trucks, one uses VehicleBody and the other Rigidbody.
If you check the player script you can uncomment and use move_and_slide, move_and_slide_and_snap, and move_and_collide. All will move the trucks.

[clustertruckclone.zip](https://github.com/godotengine/godot/files/3576978/clustertruckclone.zip)
Repository: rust
Issue: Distinguish between fenced and indented code blocks in error message
Labels: T-rustdoc,C-enhancement,A-diagnostics,A-docs,A-doctests

EDIT: It turns out that the issue I was facing was caused by my doc comment being interpreted as a code block, based on the indented code block rule in markdown.

--

## Summary
The following doc comment fails to compile using `cargo test --doc`:

```rust
///
///    \
///x
```
Example repository [here](https://github.com/lightclient/rust-doc-comment-bug).

## Error Output
```console
> cargo test --doc
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Doc-tests weird

running 1 test
test src/lib.rs - main (line 2) ... FAILED

failures:

---- src/lib.rs - main (line 2) stdout ----
error: unknown start of token: \
 --> src/lib.rs:3:1
  |
3 | \
  | ^

error: aborting due to previous error

Couldn't compile the test.

failures:
    src/lib.rs - main (line 2)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--doc'
```
## What I've Tried
I've found a few things (I'm sure this is not an exhaustive list to describe the problem):
* There must be an empty line above the backslash
* There must be a non-empty line below the backslash
* There must be at least 4 spaces between the backslash and the doc comment `///`

## Expected
The snippet compiles without issue.

## Meta

I've verified the issue is present using `1.37.0` on both `x86_64-apple-darwin` and `x86_64-unknown-linux-gnu`.
Repository: TypeScript
Issue: keyof T should never print as a union of strings
Labels: Suggestion,In Discussion

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.6.2

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:** extends keyof generic

**Code**

```ts
export const bindEvent = <Node extends HTMLElement | HTMLDocument,
	K extends keyof HTMLElementEventMap>(
	node: Node,
	type: K,
	callback: (event: HTMLElementEventMap[K]) => unknown,
) => {
	node.addEventListener(type, callback as EventListener);

	return () => {
		node.removeEventListener(type, callback as EventListener);
	};
};

tsc
```

**Expected behavior:**
The generic `K` to still be extends keyof, instead of spreading the type out.

**Actual behavior:**
types generated:
```ts
export declare const bindEvent: <Node_1 extends HTMLElement | HTMLDocument, K extends "fullscreenchange" | "fullscreenerror" | "abort" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "cancel" | "canplay" | "canplaythrough" | "change" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "ended" | "error" | "focus" | "focusin" | "focusout" | "gotpointercapture" | "input" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadend" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "progress" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "select" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "waiting" | "wheel" | "copy" | "cut" | "paste">(node: Node_1, type: K, callback: (event: HTMLElementEventMap[K]) => unknown) => () => void;

```
Repository: flutter
Issue: [google_maps_flutter] Markers do not obey consumeTapEvents configuration
Labels: p: maps,package,team-ecosystem,has reproducible steps,P2,found in release: 2.3,triaged-ecosystem

If you set Marker.consumeTapEvents I would expect the onTap handler not to be called. Currently the event is passed to onTap.

When setting consumeTapEvents to false for Polygons, Polylines, Circles etc. the click handler is not attached to the element, for markers there is no option to disable the click listener in the Google Maps implementation so the result needs to be filtered out in the marker click listener.

Both iOS and Android are affected.