sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: CPU torch.exponential_ function may generate 0 which can cause downstream NaN
Labels: triaged,module: random

## 🐛 Bug

torch.exponential_ on the CPU has a small (2^-53) chance of generating 0.

I don't think we document whether torch.exponential_ may return 0, but both the [NumPy](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.exponential.html) and [TF](https://www.tensorflow.org/api_docs/python/tf/distributions/Exponential) documentation pages don't allow for zero. This is convenient for downstream uses, such as Gumbel-softmax.

The CPU exponential generation function computes `-log(1-uniform())` (always in double-precision). The result is then rounded to the desired data type (e.g. float).

https://github.com/pytorch/pytorch/blob/042da2171e95ae5cf39452ae17a5000a5a24eb85/aten/src/ATen/core/DistributionsHelper.h#L209-L212

If `sample` is `0`, then `log(1.0 - sample)` is also `0`. Note that `sample=1` is also not allowed.

The CUDA generator doesn't have this issue because it shifts the probability mass around zero to log(1-eps).

Related to https://github.com/pytorch/pytorch/issues/22442.

## To Reproduce

I haven't reproduced this behavior. It would be nice to have specific bitstreams for RNG testing that always return specific sequences (such as 0) to test for this sort of behavior.
Repository: go
Issue: x/crypto/ssh: add NewControlClientConn
Labels: Proposal,Proposal-Accepted,Proposal-Crypto

**Update, 23 Feb 2022**: The new API is https://github.com/golang/go/issues/32958#issuecomment-1034079379.

---

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.12.6 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>
$ go env
GOARCH="amd64"                         
GOBIN=""                               
GOCACHE="/tmp/bazel_shared/gocache"    
GOEXE=""                               
GOFLAGS="-mod=readonly"                
GOHOSTARCH="amd64"                     
GOHOSTOS="linux"                       
GOOS="linux"                           
GOPATH="/tmp/bazel_shared/gopath"      
GOPROXY="direct"                       
GORACE=""                              
GOROOT="/home/cy/.cache/bazel/_bazel_cy/80b33c882b53d18473a4d1179c663f81/external/go_sdk"                                                                     
GOTMPDIR=""                            
GOTOOLDIR="/home/cy/.cache/bazel/_bazel_cy/80b33c882b53d18473a4d1179c663f81/external/go_sdk/pkg/tool/linux_amd64"                                             
GCCGO="gccgo"                          
CC="gcc"                               
CXX="g++"                              
CGO_ENABLED="0"                        
GOMOD="/home/cy/.cache/bazel/_bazel_cy/80b33c882b53d18473a4d1179c663f81/execroot/goslackgo/bazel-out/k8-fastbuild/bin/go.runfiles/goslackgo/go_gocmd_execroot/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build807263343=/tmp/go-build -gno-record-gcc-switches" 
</pre></details>

### Proposal: Feature Request

I propose a modification to the x/crypto/ssh library that would allow an application to use this library's implementation of the SSH Connection Protocol (RFC 4254), but provide a separate implementation of the SSH Transport Protocol (RFC 4253).

Concretely this would require adapting the existing  `packetConn` interface and exporting it, and then adding a Client constructor that operated on this interface:

<pre>
type Transport interface {
  WritePacket([]byte) error
  ReadPacket() ([]byte, error)
  Close() error
}

func NewClientFromTransport(t Transport) (Conn, <-chan NewChannel, <-chan *Request, error) 
</pre>

My immediate use case for this is to implement an application that uses an OpenSSH ControlMaster socket as the transport. However, I can imagine other use cases for this. This proposal is an alternative to https://github.com/golang/go/issues/31874.
Repository: opencv
Issue: Error when call InputArray.getMat() obtained from vector<vector<double>>
Labels: category: core,category: build/install

OpenCV 3.4.4
OS: Ubuntu 19.04

Code:
```
vector<vector<double>> vv = {{1, 1, 0},  
			   	{1, -1, 0},
				{-1, -1, 0},
				{-1, 1, 0}};
InputArray ia(vv);`
cout << ia.getMat() << endl;`
```
Error:
```
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.4) /home/victor/development/opencv/modules/core/src/matrix_wrap.cpp:79: 
error: (-215:Assertion failed) 0 <= i && i < (int)vv.size() in function 'getMat_'
```
Repository: flutter
Issue: No clear way to get the number of lines from a Paragraph
Labels: c: new feature,framework,a: typography,P3,team-framework,triaged-framework

If I have some text like this:

```
final text = 'My text line.\nThis كلمة makes more boxes.\nAnother line.';
```

And when I create a Paragraph (indirectly using TextPainter), then I get something like this:

<img width="304" alt="Screen Shot 2019-07-05 at 6 17 09 PM" src="https://user-images.githubusercontent.com/10300220/60750117-c4405680-9f58-11e9-9d1b-400a1fdb7592.png">

I want to programmatically get the number of lines (and the text in each line). But there is no method for that. There obviously are 4 lines and the engine must know that. Is there a reason that it is hidden from the developer?

My use case is creating a [vertical text layout](https://stackoverflow.com/questions/56782788/vertical-text-widget-for-flutter) where I have to reposition and paint each line myself.

Related Stack Overflow issue: https://stackoverflow.com/questions/54091055/flutter-how-to-get-the-number-of-text-lines
Repository: godot
Issue: File Dialog modal closes on hidden file toggle keyboard shortcut after item selected and deselected
Labels: bug,topic:editor,confirmed

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->
This issue also causes the editor to stay darkened once the modal is closed as per issue #30368 
**Godot version:**
<!-- Specify commit hash if non-official. -->
d897131ac555de84afe9ca6845abf87c26957895

**OS/device including version:**
<!-- Specify GPU model and drivers if graphics-related. -->
Arch Linux

**Issue description:**
<!-- What happened, and what was expected. -->
File Dialog modal closes on hidden file toggle keyboard shortcut after item selected and deselected. Expected behavior is a toggle that shows hidden files. 

**Steps to reproduce:**
1. Cause the file dialog to open, e.g press load on an empty texture property in a sprite
2. Click on a file in the manager
3. Click on the empty space in the directory, deselecting the file
4. Press the CTRL + H shortcut to toggle visibility of hidden files
The file dialog disappears and the editor stays darkened. 

**Minimal reproduction project:**
<!-- Recommended as it greatly speeds up debugging. Drag and drop a zip archive to upload it. -->
[godot-darkened-after-dialog-shortcut.zip](https://github.com/godotengine/godot/files/3364432/godot-darkened-after-dialog-shortcut.zip)
Repository: vscode
Issue: The `cursorWordPart`* commands are limited to editor text, unlike the other `cursorWord`* commands
Labels: feature-request,editor-find

- VSCode Version: 1.36.0 (system setup)
- OS Version: Windows_NT x64 10.0.18362

Steps to Reproduce:

1. Focus on a non-editor input text field (e.g. execute the command `workbench.action.quickOpen` or `actions.find`, inter alia)
2. Insert the text of the multi-part word "fooBar".
3. Move the cursor to the end of the multi-part word text.
4. Enter your keybinding for the command `cursorWordPartLeft`.

Expected behavior:

* Cursor moves to between "foo" and "Bar", i.e. `foo|Bar`.

Actual behavior:

* No effect.

Notes:

* This limitation appears in all `inputText` contexts other than the `editorText` context.
* This limitation affects all the `cursorWordPart`* commands:
  * `cursorWordPartLeft`
  * `cursorWordPartLeftSelect`
  * `cursorWordPartRight`
  * `cursorWordPartRightSelect`
  * `cursorWordPartStartLeft`
  * `cursorWordPartStartLeftSelect`
* The corresponding whole-word commands (those without the "Part" infix) are not limited, i.e. they function in `inputText` contexts other than the `editorText` context.

Does this issue occur when all extensions are disabled?: Yes
Repository: godot
Issue: Error messages when plugins are faulty not normally shown
Labels: bug,topic:editor,confirmed,usability,topic:plugin

**Godot version:**
3.1.1

**OS/device including version:**
N/A

**Issue description:**
Related to https://github.com/jebedaia360/Rakugo/issues/153

Attempting to set up Rakugo with Godot, I noticed the plugin.gd script does not work. However by default Godot does not report *why* it failed; it does not tell you what the errors are, unless you are running Godot from the terminal.

*From inside Godot*
![a](https://user-images.githubusercontent.com/324679/60755355-868a0f00-9fe6-11e9-8404-eb2cc5e04116.png)

*From the terminal*
```
SCRIPT ERROR: GDScript::reload: Parse Error: Identifier 'Rakugo' is not declared in the current scope.
   At: res://addons/Rakugo/nodes/rakugo_menu.gd:12.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:580.
SCRIPT ERROR: GDScript::reload: Parse Error: Could not fully preload the script, possible cyclic reference or compilation error. Use 'load()' instead if a cyclic reference is intended.
   At: res://addons/Rakugo/plugin.gd:65.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:580.
SCRIPT ERROR: GDScript::reload: Parse Error: Identifier 'Rakugo' is not declared in the current scope.
   At: res://addons/Rakugo/nodes/rakugo_menu.gd:12.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:580.
SCRIPT ERROR: GDScript::reload: Parse Error: Could not fully preload the script, possible cyclic reference or compilation error. Use 'load()' instead if a cyclic reference is intended.
   At: res://addons/Rakugo/plugin.gd:65.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:580.
```

**Steps to reproduce:**
Use an addon with a plugin.gd that has an error of some kind.

**Minimal reproduction project:**
In this case, I was using https://github.com/jebedaia360/Rakugo/commit/33b09b6685289f0e3aabf0254064a76b814575c7
Repository: rust
Issue: Build with clean incremental cache slower than without incremental compilation
Labels: I-compiletime,T-compiler,A-incr-comp,C-bug

```
$ rustc -V
rustc 1.36.0 (a53f9df32 2019-07-03)

$ git clone https://github.com/bjorn3/fractals
$ cd fractals
$ git checkout 0c4929c80c55cadf3a2576f288bfde463ffb8e18
$ cargo build # build deps

$ # build without incr comp
$ touch src/main; CARGO_INCREMENTAL=0 cargo build
   Compiling fractals v0.1.0 (/home/bjorn/Documenten/fractals)
    Finished dev [unoptimized + debuginfo] target(s) in 2.74s

$ # incremental cache was thrown away by the previous command; rebuild it
$ touch src/main.rs; CARGO_INCREMENTAL=1 cargo build
   Compiling fractals v0.1.0 (/home/bjorn/Documenten/fractals)
    Finished dev [unoptimized + debuginfo] target(s) in 13.47s

$ # incremental cache exists. yet the build is slower than without incr comp
$ touch src/main.rs; CARGO_INCREMENTAL=1 cargo build
   Compiling fractals v0.1.0 (/home/bjorn/Documenten/fractals)
    Finished dev [unoptimized + debuginfo] target(s) in 4.45s
```
Repository: TypeScript
Issue: Allow Inifinity and -Infinity as number literal types
Labels: Suggestion,Awaiting More Feedback

Please accept `Infinity` and `-Infinity` as valid number literal types.

```ts
/** A range of BigInt that may be unbounded, e.g., (-∞, 5] */
class BigIntRange {
  public min: bigint | -Infinity = 0n; // <= Error!
  public max: bigint | Infinity = 1n; // <= Error!
  public isValid(): boolean {
    return this.min <= this.max;
  }
}
```

Currently, This causes a compile error, `'Infinity' refers to a value, but is being used as a type here. (2749)`.

I understand this was once rejected as part of #15135 and #15356, and the given reasons were: 1) difficult to implement, and 2) lacks a compelling use case.

However, while I understand why `NaN` as a literal type is tricky to implement, `NaN` and `Infinity` are not the same. And I have a clear use case for `Infinity` as a meaningful literal type, as shown above.

### Infinity is not tricky to compare

Unlike notorious `NaN` or `-0`, `Infinity` works **just like an ordinary numeric constant** as far as equality is concerned. We don't need a special function like `isNaN()` or `Object.is()`. Ever since the ES5/IE6 era, there has been nothing counter-intuitive:

```ts
Infinity === Infinity // => true
-Infinity === -Infinity // => true
Number.POSITIVE_INFINITY === Infinity // => true
Object.is(-Infinity, Number.NEGATIVE_INFINITY) // => true
10 ** 500 === Infinity // => true (because 10**500 is above Number.MAX_VALUE)

typeof Infinity === 'number' // => true
typeof Number.NEGATIVE_INFINITY === 'number' // => true

// FWIW, comparison works just as expected, too
50 < Infinity // => true
-Infinity < 50; // => true
10n ** 500n < Infinity // => true
Number.MAX_VALUE < Infinity // => true
Infinity < Infinity // => false
```

Most importantly, `Infinity === Infinity` is true (while `NaN === NaN` is false). Unless I'm missing something, predictable equality is all that's required to safely use `Infinity` as a literal type, right? Even though the design note (#15356) says "there is more than one NaN, Infinity, etc", you can think of `Infinity` in JavaScript as "just a fixed number" which happens to be larger than `Number.MAX_VALUE`.

### My use case

[My library](https://www.npmjs.com/package/multi-integer-range) deals with unbounded (aka infinite) integer ranges, and I have been using `Infinity` and `-Infinity` without any issue to denote what they literally mean, _infinity in the mathematical sense_. I have instructed my users to use these interesting constants, too. Recently I started to extend my library to support `bigint` in addition to `number`, and ran into this problem.

You may ask "Why don't you just use string `'Infinity'` or `Symbol('unbounded')`", but `Infinity` is a predefined and predictable constant, and it can be directly compared with any bigint (e.g., `10n ** 1000n < Infinity` is `true`). See how simple the implementation of `isValid` can be in the first example.

PS: Looks like there is a hacky workaround (#31752), but I'd like to see the official support.
Repository: rust
Issue: Unnecessary copy when constructing arrays from returned arrays?
Labels: A-LLVM,I-slow,C-enhancement,T-compiler,A-mir-opt,A-mir-opt-nrvo,C-optimization

I want to construct a big array by concatenating smaller arrays returned by other functions. As a simple example:

```rust
pub fn g(f: &Fn() -> [u64;40]) -> [u64;80] {
    let a = f();
    let b = f();
    let mut ret = [0u64;80];
    ret[0..40].copy_from_slice(&a[..]);
    ret[40..80].copy_from_slice(&b[..]);
    ret
}
```

Rust nightly [generates a call to memcpy](https://godbolt.org/z/XeVwFj).

Is there a way to prevent this memcpy?  Am I missing obvious other way to write this function?

Of course one could rewrite the called function `f` to take a `&mut [u64]` instead of returning the array, but that removes compile-time checks on the length and introduces bounds checks.  Using `&mut [u64;40]` as an "out" argument solves that problem, but then I don't see a safe way to get two `&mut [u64;40]` into `[u64;80]` without using `transmute`.

(Background: I'm implementing the XMSSMT hash-based signature in Rust, which involves concatenating lots of hashes.  The [usual Rust hash library](https://github.com/RustCrypto/hashes) returns an array (actually a `GenericArray`) instead of using a `&mut [u64;...]` parameter which led me to believe that the copy could be optimised away.)
Repository: rust
Issue: build fails with error[E0463]: can't find crate for `rustc_macros` which `rustc` depends on  in rustc_llvm
Labels: T-bootstrap,O-musl

Hello,

We hit this while compiling rust 1.35.0 -> rust 1.36.0 on x86. This is for the distro package for Alpine Linux. Please note that we're compiling against our own triplets, in this case it's for i586-alpine-linux-musl, see the definition here: https://gist.github.com/6bae5fdcf6bb5a95b3b779ceb2dd79f7

I'm pretty sure that that error is on us - but the error message doesn't really help me solve it, so maybe `x.py`/`configure` should catch this and give a better error message? A pointer in the right direction would certainly be very appreciated :)

See https://cloud.drone.io/alpinelinux/aports/8259/1/1

Thanks
Repository: TypeScript
Issue: Inconsistent implicit any when referencing destructured variable more than once
Labels: Bug

**TypeScript Version:**  3.5.2 and 3.5.1

**Search Terms:** TS7022, "missing implicit any", "inconsistent implicit any", "does not have a type annotation", "referenced directly or indirectly in its own initializer"

**Code**

```ts
type Updater<T> = (t: T) => void;

function createUpdater<T>(t: T): [T, Updater<T>] {
    return [t, function(newT: T) {}]
}

interface State {
    value: number;
    increment: (delta: number) => void;
    decrement: (delta: number) => void;
}

const [state1, setState1] = createUpdater<State>({
    value: 2,
    increment: delta => setState1({
        ...state1,
        value: state1.value + delta
    }),
    decrement: delta => setState1({
        ...state1,
        value: state1.value - delta
    })
})

const [state2, setState2]: [State, Updater<State>] = createUpdater<State>({
    value: 2,
    increment: delta => setState2({
        ...state2,
        value: state2.value + delta
    }),
    decrement: delta => setState2({
        ...state2,
        value: state2.value - delta
    })
})

const [state3, setState3] = createUpdater<State>({
    value: 2,
    increment: delta => setState3({
        ...state3,
        value: state3.value + delta
    }),
    decrement: delta => {}
})
```

**Expected behavior:** `setState1` would not trigger an error, **or** `setState3` would trigger an error.

**Actual behavior:** `setState1` triggers an error TS7022, while `setState3` does not.

**Playground Link:** [TypeScript playground link](http://www.typescriptlang.org/play/#code/C4TwDgpgBAqmAmBDYEBOAeAKgPigXigApgAuKTASn1wDcB7AS3gG4AoVgMwFcA7AY2AM6PKH1QRkEOEhQYcxMpTIBtTABpYCSXOwBdKAG9WUE1HHAuqEcuAbu-QcMI8IAd0yKqBgL67W39gYeWQ5EPmgAZWBJQ2NTGkQAGy4IMh4uAFsAIzQ2UyggsQgMiGCyQngIROi0zJzUKjxaRhY4k0qikrKiSurEWuy0RuamNgDWPmEAZ2AoZRnJAEYNKYhgKKX9AiLJaW10DZRsQiN8hOTUqAAmNTaC-nEu0ihe6OooVfXolEWTu-yAHRAhY-W75M5JFJkEEQRYA84pKAAaheVWid28FDBpg6j1Kz1eiHen0OsL+4NMQIBMOW-3ikMuNPhDKgAFpUX0MRR-NyJtNZvNvhAbh81qSrroVKSNHtZAchXp8KJxLstHLScdTvSLmQbndCnjuoTiWKhVdyRSoFSYXrLVAEYyzcyLsiOej8pjse0IJ18WRjU1RV9JOatRTrWaveCHdCnQ62W7EFyeexJjwZnMYQBmFamyRZrbKiQoWVoeWSTV3GPXKMG4p+xMm4MoLMW8PAoU5ukmavZ52IlGErlR3H1o1oomBnw8oA)

**Related Issues:** #6935 (?)

**Note: The only discernable difference in `setState1` and `setState3`, is that `setState1` is called in `state1.decrement` while `setState3` is not called in `state3.decrement`.** However, I'm still learning a lot about TS, and this issue seems like multiple things are at play - so I'm really not confident in my description of the problem (issue title) or my search/comparison of other issues.
Repository: terminal
Issue: WriteConsoleOutputCharacterA doesn't merge UTF-8 partials in successive calls
Labels: Product-Conhost,Area-Output,Area-Server,Issue-Bug

<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement.
2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement.
3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number).
4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement.
5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement.

All good? Then proceed!
-->

<!--
This bug tracker is monitored by Windows Terminal development team and other technical folks.

**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.

Please use this form and describe your issue, concisely but precisely, with as much detail as possible.

-->

# Environment

```
Windows build number: [run "ver" at a command prompt]
Microsoft Windows [Version 10.0.18362.207]
```

# Steps to reproduce

<!-- A description of how to trigger this bug. -->
If a UTF-8 stream gets buffered in a loop, characters that consume more than one byte may get split at the buffer boundaries. Passing the buffer to `WriteConsoleOutputCharacterA` will corrupt the text because a conversion to UTF-16 is in place where these partials are treated as invalid UTF-8 characters and replaced with with U+FFFD characters.

# Expected behavior

<!-- A description of what you're expecting, possibly containing screenshots or reference material. -->
`WriteConsoleOutputCharacterA` should cache the partials and prepend them to the characters passed at the next call of this function, similar to the behavior of `WriteConsoleA`.

# Actual behavior

<!-- What's actually happening? -->
UTF-8 partials result in corrupted text.
A discussion about this already began in #386 but was rather out of scope in this issue.
Repository: flutter
Issue: PageScrollPhysics has weird behavior
Labels: framework,f: scrolling,platform-web,a: desktop,a: mouse,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-framework,triaged-framework

`PageScrollPhysics()` has strange behavior across all browsers when scrolling with the mouse view. This can be easily reproduced by creating a ListView with many elements and supplying PageScrollPhysics as an argument to the physics parameter.

GIF Example:
https://gyazo.com/f63a01031ce5e309aa142b20da3c92b5