sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: rust
Issue: TcpStream with non_blocking mode and read_to_end() leads to incomplete message
Labels: C-bug,T-libs,A-io

I ran in to this problem:

I have a TcpStream set on non_blocking(true). When I read from it, depending on the delay after I send the http request, it may drop some data of the reponse or not. It shouldn't work like this anyway.

Moreover, it seems like that read_to_end will end when meeting EOF. How will this behavior in non_blocking mode? Is there a way to tell how many bytes is ready without actually reading in order to pre-allocate buffers?


## When the delay is less than 30 ms
```log
len: 183
);};}})();};if(window.pageState==0){initIndex();}})();document.cookie = 'IS_STATIC=1;expires=' + new Date(new Date().getTime() + 10*60*1000).toGMTString();</script>
</body></html>
```
## When the delay is more than 30 ms, say 100 ms
```log
len: 15550
 HTTP/1.0 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Content-Length: 14615
Content-Type: text/html
<more>
```

## Code
```rust
use std::io::{Write, Read};
use std::net::TcpStream;
use std::{str, thread};
use std::time::Duration;

#[allow(dead_code)]
fn sleep(ms: u64) {
    thread::sleep(Duration::from_millis(ms));
}

fn main() {
    // www.baidu.com
    let mut tcp = TcpStream::connect("39.156.66.14:80").unwrap();
    tcp.set_nonblocking(true).unwrap();
    tcp.set_nodelay(true).unwrap();
    tcp.write(b"GET / HTTP/1.0\r\n\r\n").unwrap();
    // FIXME if sleep time is less than 30, it will receive incomplete message
    // sleep(0);
    sleep(100);
    loop {
        tcp.flush().unwrap();
        let mut v = vec![];
        // FIXME does read to end make sense for non blocking?
        match tcp.read_to_end(&mut v) {
            Ok(n) => {
                if v.len() > 0 {
                    unsafe {
                        println!("len: {}\n {}", n, str::from_utf8_unchecked(&v));
                    }
                    break;
                }
            }
            Err(_e) => {
                print!(".");
            }
        }
    }
}
```
Repository: flutter
Issue: Documentation for web support and integration
Labels: d: api docs,platform-web,P2,team-web,triaged-web

Flutter API docs should clearly specify features unavailable in the web and the known issues related to specific widgets. Basic web features should be well documented. For example many of the features which completely depend on the browser can be achieved by using `package:js`. However this is not documented anywhere.
Repository: go
Issue: x/net/http2: expose which TLS cipher suites are HTTP/2 safe
Labels: NeedsInvestigation

Launching a web server with the SSL ciphers list taken from the TLS package does not work. I get the following error, that I can't get around programatically:

`http2: TLSConfig.CipherSuites index 5 contains an HTTP/2-approved cipher suite (0x1301), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.`

### What version of Go are you using (`go version`)?
<pre>
1.14
</pre>

### Does this issue reproduce with the latest release?
yes (1.15)

### What operating system and processor architecture are you using (`go env`)?
<details><summary><code>go env</code> Output</summary><br><pre>
set GOHOSTARCH=amd64
set GOHOSTOS=windows
</pre></details>

### What did you do?
I tried to launch a web server with a custom TLS config, with ciphers taken from tls.CipherSuites(). I do have one of these 2 dead ends:
- Ciphers returned by tls.CipherSuites() are not in a suitable order with HTTP/2-approved ciphers first (I guess, they are not intended to be).
- http2isBadCipher() in /net/http/h2_bundle.go is not exposed, so I can't sort ciphers accordingly on my own (I don't want to copy that function, because it seems it could get updated over time).


Here is a sample snippet:
```
		// Prepare list of accepted cipher suites
		var ciphers []uint16
		for _, cipher := range tls.CipherSuites() {
			if cipher.Insecure == false {
				ciphers = append(ciphers, cipher.ID)
			}
		}

		// Create TLS config
		tlsConf :=  &tls.Config{
			MinVersion:         tls.VersionTLS13,
			MaxVersion:         tls.VersionTLS13,
			CipherSuites:       ciphers,
		}

		// Create TLS web server
		server := &http.Server{Addr: listen, Handler: mux, TLSConfig: tlsConf}

		// Start TLS web server
		_ = server.ListenAndServeTLS("cert.crt", "cert.key")
```



### What did you expect to see?
I just couldn't find a way to programatically order the ciphers as required, with the means available.


### What did you see instead?
A critical error and program termination.
Repository: node
Issue: doc: Buffer.prototype.byteLength is undocumented
Labels: buffer,doc

# 📗 API Reference Docs Problem

- **Subsystem**:  buffer

## Location

Affected URL(s):

- https://nodejs.org/api/buffer.html

## Description

Buffer instances have a undocumented `.byteLength` property. We should document it. Docs only exist for the  static method `Buffer.byteLength` but not for `Buffer.prototype.byteLength`.

````js
> Buffer.from("📗").byteLength
4
````

---

- [ ] I would like to work on this issue and submit a pull request.
Repository: godot
Issue: Confusing representation of empty string in array
Labels: topic:core

**Godot version:** 3.2.2.stable & d30c3d0 (current master)


**OS/device including version:** not graphics related


**Issue description:**

Can't distinguish between `[]` and `[""]` by printing them out. The output shows `[]` for both of them.

```
print([])
print([""])
print(["A","B"])
print(["A","", "B"])

# The corresponding output:
[]
[]
[A, B]
[A, , B]
```

I expect the strings in the array to be quoted. Or, at least, make the representations of `[]` and `[""]` different, as there are commas to make the empty string "visible" in other cases.

This also affects editor debugging, the tooltip of a variable shows `[]` for `[""]`:

![tooltip](https://user-images.githubusercontent.com/372476/91425430-b4d34980-e88d-11ea-9514-7f364168d6b0.png)

The same goes for keyframes in a call method track.

**Steps to reproduce:**
Run the code above.

**Minimal reproduction project:** Copy & pasting the four lines of code is easier.
Repository: flutter
Issue: Android Autofill fails on projects created before Flutter 1.12
Labels: framework,f: material design,d: api docs,P3,team-design,triaged-design

Autofill doesn't work on Android when a project has been created with an older, pre-v1.12 version of Flutter.

Autofill worked fine for us on iOS, but on Android the debug autofill provider would tell us that no autofill hints were found on the text field.

This is reproducible:

1. Downgrade to a pre-v1.12 version of Flutter - `flutter version v1.9.1+hotfix.6`
2. Create a project
3. Upgrade to latest stable, 1.20.2
4. Add a text field with autofill hints
5. Run on Android, and find that autofill doesn't work

I tried upgrading to the beta channel, and saw a warning linking to https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects, on a hunch I followed the steps and autofill started working.

I guess the question is: is this a bug that needs fixing? Or should it just be documented, or have Flutter show a warning? Either way, it’s very confusing and I’m sure it’ll bite other developers with older projects.

CC @LongCatIsLooong (also: autofill is awesome, thank you!)
Repository: youtube-dl
Issue: download biggest file size
Labels: question

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- Look through the README (http://yt-dl.org/readme) and FAQ (http://yt-dl.org/faq) for similar questions
- Search the bugtracker for similar questions: http://yt-dl.org/search-issues
- Finally, put x into all relevant boxes (like this [x])
-->

- [x] I'm asking a question
- [x] I've looked through the README and FAQ for similar questions
- [x] I've searched the bugtracker for similar questions including closed ones


## Question

<!--
Ask your question in an arbitrary form. Please make sure it's worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient.
-->

How can I make youtube-dl automatically pick the file with the biggest size regardless of extension? best/bestvideo seems to just pick the highest quality mp4 unless there's a webm with a higher resolution. For example, if the 1080p webm is 150MiB and the 1080p mp4 is 145MiB, youtube-dl picks the mp4 unless there's a 1440p webm available and no 1440p mp4.

I'm using the latest version.

edit:
I've read on reddit that the sole deciding factor for "best" is bitrate. Shouldn't higher bitrate mean bigger file size though? So what's happening here?
```
[info] Available formats for HEtQWgDldA8:
format code  extension  resolution note
247          webm       1280x720   720p 1494k , vp9, 24fps, video only, 101.34MiB
136          mp4        1280x720   720p 2404k , avc1.4d401f, 24fps, video only, 95.38MiB
```
Repository: flutter
Issue: Draggable hit testing improvements
Labels: framework,f: material design,c: proposal,team-design,triaged-design

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

Currently when using a Draggable hit testing is only done when the draggable is moved by the user.
So if the app is animating while the draggable is being held the dragtargets get out of sync with the users finger.

Next to this scrolling a scrollview will prevent all hit testing on its children.
While this makes sense for any hit test triggered by the user it does not for the draggable since this will also leave the dragtargets and the users finger out of sync.

In my local Flutter checkout I already played around with some options.
To fix the first part I ended up with a combination of having a static list of all the active drag avatars and adding a persistent frame callback to the scheduler that will update the drag avatar on every frame.
This does feel a bit hacky so maybe there is a better solution for this?

For the hit testing while scrolling I managed to make it work by having the IgnorePointer widget have an option to always allow hit tests of a drag avatar and enabling this in the Scrollable widget, this however involves tightly coupling IgnorePointer to DragTarget which again feels hacky.

However, when using both these solutions together you get a really nice feeling implementation of Draggable that is always in sync with what the user is doing, greatly improving the experience

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe the alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

## Proposal

Let us come up with a nice and clean solution to improve these draggable behaviours

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching images showing what you are imagining.

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->
Repository: vscode
Issue: [cli] specify command that runs on window open
Labels: feature-request,workbench-cli

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
I would like to launch VS Code and start a specific command on startup.

That would reliably allow for task-specific configurations of VS Code on startup.

#### Proposed API:

* `--run-command <command_name> [--cmd-arg <command_argument>] *`
* `--run-command` should be able to be given multiple times. In that case the commands should be executed sequentially after startup.
* `--cmd-arg` must be directly after a `--run-command` or `--cmd-arg` block, else the launch should fail.
* `-c` could be a short form for `--run-command` and `-C` for `--cmd-arg`

#### Usecases:

- `code --run-command "myExtension.3WayMerge" --cmd-arg "myBase" --cmd-arg "myLocal" --cmd-arg "myRemote"`
- `code --run-command "myExtension.jumpstartIntoRepo" --cmd-arg "https://github.com/x/y" --new-window`
Repository: terminal
Issue: While mouse over on titlebar, allow to react to Ctrl+MouseScroll human-events on to active tab.
Labels: Help Wanted,Area-Input,Product-Terminal,Issue-Task,Priority-3

<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

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!
-->

# Description of the new feature/enhancement

Then mouse is over WindowsTerminal's titlebar,  Ctrl+MouseScroll events should be handled the same way as mouse would be over inside terminal window.

I am using Windows Terminal with SSH client to connect to linux remotes. And then I open linux htop cli-utility I cannot rezoom Windows terminal.

# Proposed technical implementation details (optional)

<!-- 
A clear and concise description of what you want to happen.
-->
Ctrl+mouse_scroll should allow zoom-in/out currently active tab THEN mouse is over windows-terminal's titlebar's blank space.

Currently I need to exit htop to rezoom and then reenter htop.

To replicate original problem:
1) Enter powershell via WindowsTerminal.
2) Execute:
`$ ssh user@hostname -p 22 -i ~/.ssh/id_ed25519`
`$ htop`
3) Try to rezoom with _Ctrl+MouseScroll_ , you cannot.
4) Exit `htop` by pressing Q.
5) Now you can rezoom with _Ctrl+MouseScroll_ in WindowsTerminal
Repository: electron
Issue: SimpleURLLoader does not work with register*Protocol
Labels: platform/windows,platform/linux,bug :beetle:,status/confirmed,8-x-y,9-x-y,10-x-y,11-x-y

### Preflight Checklist
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * master
* **Operating System:**
  * Windows 10
* **Last Known Working Electron version:**
  * undefined

### Expected Behavior
SimpleURLLoader and `net` should work with protocols registered through `register*Protocol` APIs.

### Actual Behavior
Making a request using `SimpleURLLoader` to an URL with a custom scheme registered through `register*Protocol` throws -302 (ERR_UNKNOWN_URL_SCHEME), but works fine with `intercept*Protocol`. `net` module doesn't even try to make a request to a scheme that is not in `kSupportedProtocols`.

It does not respect `NonNetworkURLLoaderFactoryMap` and reaches this code (removing the check makes the request fail with -2):
https://source.chromium.org/chromium/chromium/src/+/master:net/url_request/url_request_job_manager.cc;l=63?q=UNKNOWN_URL_SCHEME

### To Reproduce
https://gist.github.com/ca870d4558119e31e991bb5cf61981c5

The app should print `asdf` and `test` in the console.
Repository: go
Issue: cmd/cgo: CFLAGS not passed in godefs mode
Labels: NeedsFix,compiler/runtime

### What version of Go are you using (`go version`)?
Master, 1.15, 1.14.7 and 1.13.13

### What operating system and processor architecture are you using (`go env`)?
Found on aix/ppc64, but same on linux/amd64

### What did you do?
The `#cgo CFLAGS` directive is ignored when using `-godefs` mode. 
The following example shows it with a define. Of course, `#cgo CFLAGS: -D_D1` can be replaced by `#define _D1` and it will work. But that's not possible, AFAIK, for gcc flags like "-fms-extensions" which I need to pass for another code.   
```
package p

/*
#cgo CFLAGS: -D_D1

#ifdef _D1
typedef struct S1 {
        int a;
} S1_t;
#endif
*/
import "C"

type S1 C.struct_S1
```


### What did you expect to see?
```
$ go tool cgo -godefs  godefs.go 
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs godefs.go

package p

type S1 struct {
	A int32
}
```

### What did you see instead?
```
$ go tool cgo -godefs  godefs.go 
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs godefs.go

package p

type S1 struct{}
```
Repository: rust
Issue: Inconsistent iterator optimization
Labels: A-const-eval,A-mir-opt

I'm not sure if this is the fault of const propagation (probably not?), but these [examples](https://rust.godbolt.org/z/EjW13c) ([more examples, but a lot more messy](https://rust.godbolt.org/z/Ks48Ke)) result in unexpected code.

In some instances, the function bodies are evaluated and are replaced by a constant value as expected. However, given some usage patterns, (the most simple is an extra `iterator.next` call where the return value is ignored) this simplification does not happen. It's not clear why some patterns can be simplified and others can't.
Repository: rust
Issue: Next-generation syntax highlighting for rustdoc
Labels: T-rustdoc,E-hard,C-enhancement,A-markdown-parsing

At the moment, rustdoc uses only the lexer to do syntax highlighting (#75775). This has the benefits of simplicity & performance, and gets us 80% of the way quality wise, but it is not perfect. For example, lexer-based highlighting can't properly detect contextual keywords, glued/split operators, etc. 

We can and probably should make this better, though this requires a lot of fundamental work on IDE-ification of the compiler

* the simple thing we can do is to use better heuristic to glue token (https://github.com/rust-lang/rust/pull/75775#discussion_r474794273)
* the next step is to use parser & syntax tree for highlighting. This probably should be done after parser library-ification (https://github.com/rust-lang/compiler-team/issues/338)
* the final step is to overlay semantic info, so that references are colored the same way as the things they refer to (which includes "clicking on the name should open the name's definition" as a subtask). This is already available in rust-analyzer, but will take some time to percolate to rustdoc
Repository: excalidraw
Issue: Zooming shouldn't deselect elements
Labels: bug,mobile

I understand this was added in https://github.com/excalidraw/excalidraw/pull/1333 to fix a pinch zooming issue, but this implem has the following downsides:

- It removes active selection during zoom which was already present before we started zooming, and only reinstates it after zooming is done (and with a delay). This isn't ideal.
- It's prone to bugs if we don't set & reset the `previousSelectedElementIds` state correctly, which we don't -- can't repro now, but there is a case where the selection isn't reinstated.
- Introducing `previousSelectedElementIds` state adds unnecessary (I hope) complexity. If nothing else, we should put it in `pointerDownState`.

If it can't be resolved for touch devices, we should at least not do this while mouse wheel zooming.

/cc @vnsteven for thoughts
Repository: material-ui
Issue: [Pagination] Mobile?
Labels: new feature,component: pagination

- [ ] 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 😯
![image](https://user-images.githubusercontent.com/4027842/91452450-a4bc6980-e88f-11ea-8703-32bd9a425408.png)


## Expected Behavior 🤔
![image](https://user-images.githubusercontent.com/4027842/91452676-e6e5ab00-e88f-11ea-87b7-5971ca6ca01b.png)


## Steps to Reproduce 🕹

Steps:

1. go to [https://material-ui.com/components/pagination/](https://material-ui.com/components/pagination/) on mobile browser or toggle Google Chrome to mobile view, iPhone 5 to X

## Your Environment 🌎

| Tech        | Version |
| ----------- | ------- |
| Material-UI | v4.10.1 |
Repository: rust
Issue: Late unused trait import warnings do not suggest removing
Labels: C-enhancement,A-diagnostics,A-trait-system,T-compiler

```rust
struct S;

impl S {
    fn foo(&self) {}
}

pub mod bar {
    pub struct T;

    pub trait Trait {
        fn foo(&self) {}
    }
}

use bar::T;
use bar::Trait;

pub fn main() {
    S.foo();
}
```

A tool-only suggestion to remove `use bar::T` is emitted but no such suggestion is emitted for `use bar::Trait` ([output JSON on godbolt](https://godbolt.org/z/4b4q8a)).
Repository: pytorch
Issue: checkpoint restore of optimizers changes dtype of Floating-point state
Labels: module: optimizer,triaged

## 🐛 Bug

PR #3658, in fixing an issue related to loading optimizers state on a different device, goes too far and makes floating-point state the same dtype as the parameters. This can result in a loss of precision when the state is higher precision than the parameters. In fairseq, we are working around with intricate hacks which rely on the internal details:

https://github.com/pytorch/fairseq/blob/fc27170a9e70c6485331d8c84d56142a98de8a84/fairseq/optim/fp16_optimizer.py#L276-L293 

The current behavior also makes it difficult to write unit tests for optimizer state (when state dtype differs from parameters dtype) load/save because the loaded state for the optimizer is different than the state before save.

## To Reproduce

Steps to reproduce the behavior:

1.
1.
1.

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

dtype of optimizer state should not change

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```

 - PyTorch Version (e.g., 1.0):
 - OS (e.g., Linux):
 - How you installed PyTorch (`conda`, `pip`, source):
 - Build command you used (if compiling from source):
 - Python version:
 - CUDA/cuDNN version:
 - GPU models and configuration:
 - Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->


cc @vincentqb