sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: regexp: LiteralPrefix returns surprising result for `^` anchored strings
Labels: NeedsFix

<!-- 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.5 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="/usr/local/google/home/eliben/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/eliben/go"
GOPROXY="https://proxy.golang.org"
GORACE=""
GOROOT="/usr/lib/google-golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build346731385=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

```
package main

import (
	"fmt"
	"regexp"
)

func main() {
	for _, p := range []string{"foo", "^foo"} {
		prefix, _ := regexp.MustCompile(p).LiteralPrefix()
		fmt.Printf("prefix = '%v'\n", prefix)
	}
}
```

### What did you expect to see?

The documentation for `LiteralPrefix` says:

> LiteralPrefix returns a literal string that must begin any match of the regular expression re. It returns the boolean true if the literal string comprises the entire regular expression. 

So I expected to see "foo" in both cases, since every any match of the regular expression `^foo` begins with the literal "foo".

```
prefix = 'foo'
prefix = 'foo'
```

### What did you see instead?

```
prefix = 'foo'
prefix = ''
```

In https://github.com/golang/go/issues/21463#issuecomment-326151555, @rsc says:

> "It looks like the literal prefix matcher doesn't kick in for anchored patterns, and we should fix that.

Also, see discussion in https://github.com/golang/go/issues/30425
Repository: flutter
Issue: Get Android Back Button event
Labels: c: new feature,platform-android,framework,P3,team-android,triaged-android

In my application I want to disable the back button, but I want the user to be able to pop the current screen if he click the `AppBar` back button.

Basically I have a form inside a `PageView`, so at each new form field, the `PageView` moves forward, the back button is supposed to go back one step and not pop the entire form from the screen. But still, if the user wants to pop out, he can using the back button at the top.

Currently we can only do it using `WillPopScope`, but this isn't enough, as `WillPopScope` doesn't differentiate between a physical Back button press or an `AppBar`'s back button press.
Repository: godot
Issue: Calling a method of your own Reference script within PREDELETE notification fails
Labels: bug,topic:gdscript,topic:editor,confirmed,crash

Godot 3.1.1

I made a script class which has a `clear()` function, for which the goal is to cleanup some external resources. It can be called by code using the class, or at the destruction of the instance. The only destructor logic that I know of is `NOTIFICATION_PREDELETE`.
However... that doesn't work :(

```gdscript
extends Node


class Test:
	var a = 42
	
	func _notification(what):
		if what == NOTIFICATION_PREDELETE:
			print("Predelete ", a)
			clear() # Breaks here

	func clear():
		print("Clearing Test ", a)
		

func _ready():
	var test1 = Test.new()
	test1 = null
```

When I run this, I get the following error:
```
Attempt to call function 'clear' in base 'null instance' on a null instance.
```
Which isn't helping here, and makes no sense because `_notification` was called in the first place. I would like to be be able to call functions of my own script, otherwise I have to entirely copy/paste its contents...

Note: that situation only seems to occur with `References`. If I inherit `Node` and `free()` it, the code runs normally.
I tested with inner classes but the same issue happens with file scripts.
Repository: youtube-dl
Issue: Cannot download the all the videos of a webpage
Labels: question

## Checklist

- [ 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


Hello, I keep reading the documentation and FAQ and ask on Google but I can't seem to have this right.

This page contains 3 videos on it: https://www.onecommune.com/clean-beauty-day-1

How to download all 3 videos at once. Or even chose if I would like the 2nd or 3rd video only? I cannot find a "get all videos from a page" from the documentation. Or any of these options.

There isn't anything in the documentation about this. Does anybody know if this is possible?

Bonus: It seems that the (first) video is saved as a "name_of_video.mp4-nluigeqsez.bin". I renamed it to "name_of_video.mp4" and it worked fine. But strange.
Repository: rust
Issue: chain() make collect very slow
Labels: I-slow,C-enhancement,E-mentor,T-libs-api,T-compiler,A-iterators

While working on a [SO](https://stackoverflow.com/questions/57378606/how-can-i-ensure-that-a-rust-vector-only-contains-alternating-types/57378944#57378944) question.

We was wondering if `chain()` would produce an acceptable speed, after some digging and benchmark, we come to the conclusion that `collect()` is slow because it use [`while let`](https://doc.rust-lang.org/src/alloc/vec.rs.html#1939). Unfortunately, this make collect very slow, I don't really understand why but that a fact.

But we saw that `for_each()` (probably thank to [`fold()`](https://doc.rust-lang.org/src/core/iter/adapters/chain.rs.html#101)) implementation of `chain()` don't have this problem and produce something a lot faster.

```rust
#![feature(test)]
extern crate test;

use either::Either; // 1.5.2
use std::iter;

#[derive(Debug, Default)]
pub struct Data<X, Y> {
    head: Option<Y>,
    pairs: Vec<(X, Y)>,
    tail: Option<X>,
}

impl<X, Y> Data<X, Y> {
    pub fn iter(&self) -> impl Iterator<Item = Either<&X, &Y>> {
        let head = self.head.iter().map(Either::Right);

        let pairs = self.pairs.iter().flat_map(|(a, b)| {
            let a = iter::once(Either::Left(a));
            let b = iter::once(Either::Right(b));
            a.chain(b)
        });

        let tail = self.tail.iter().map(Either::Left);

        head.chain(pairs).chain(tail)
    }
}

#[derive(Debug)]
struct AData(usize);
#[derive(Debug)]
struct BData(usize);

#[cfg(test)]
mod tests {
    use crate::{AData, BData, Data};
    use test::Bencher; // 1.5.2

    #[bench]
    fn test_for_each(b: &mut Bencher) {
        b.iter(|| {
            let data = Data {
                head: Some(BData(84)),
                pairs: std::iter::repeat_with(|| (AData(42), BData(84)))
                    .take(20998)
                    .collect(),
                tail: Some(AData(42)),
            };

            let mut data_bis = Vec::with_capacity(21000);
            data.iter().for_each(|x| data_bis.push(x));
        });
    }

    #[bench]
    fn test_collect(b: &mut Bencher) {
        b.iter(|| {
            let data = Data {
                head: Some(BData(84)),
                pairs: std::iter::repeat_with(|| (AData(42), BData(84)))
                    .take(20998)
                    .collect(),
                tail: Some(AData(42)),
            };

            let _: Vec<_> = data.iter().collect();
        });
    }
}
```

```none
test tests::test_collect  ... bench:   1,682,529 ns/iter (+/- 2,157,023)
test tests::test_for_each ... bench:     609,031 ns/iter (+/- 750,944)
```

So, should we change implementation of collect to use `for_each()` ? Note that a for loop doesn't solve the problem. For this to be optimized we need to use `for_each()`.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":null}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->
Repository: go
Issue: x/sys/cpu: add support for ARM
Labels: NeedsFix,FeatureRequest

It would be nice to have feature detection for ARM (32-bit) in `x/sys/cpu`.

Concretely, a new `cpu.ARM` struct that closely resembles the existing `cpu.ARM64` struct, tailored to the ARM specific hardware capabilities.  The following fields are proposed, which map directly to the {HWCAP, HWCAP2} auxiliary vector values on Linux and FreeBSD:

```
HasSWP      bool // SWP instruction support
HasHALF     bool // Half-word load and store support
HasTHUMB    bool // ARM Thumb instruction set
Has26BIT    bool // Address space limited to 26-bits
HasFASTMUL  bool // 32-bit operand, 64-bit result multiplication support
HasFPA      bool // Floating point arithmetic support
HasVFP      bool // Vector floating point support
HasEDSP     bool // DSP Extensions support
HasJAVA     bool // Java instruction set
HasIWMMXT   bool // Intel Wireless MMX technology support
HasCRUNCH   bool // MaverickCrunch context switching and handling
HasTHUMBEE  bool // Thumb EE instruction set
HasNEON     bool // NEON instruction set
HasVFPv3    bool // Vector floating point version 3 support
HasVFPv3D16 bool // Vector floating point version 3 D8-D15
HasTLS      bool // Thread local storage support
HasVFPv4    bool // Vector floating point version 4 support
HasIDIVA    bool // Integer divide instruction support in ARM mode
HasIDIVT    bool // Integer divide instruction support in Thumb mode
HasIDIV     bool // Integer divide instruction support in ARM and Thumb mode
HasVFPD32   bool // Vector floating point version 3 D15-D31
HasLPAE     bool // Large Physical Address Extensions
HasEVTSTRM  bool // Event stream support
HasAES      bool // AES hardware implementation
HasPMULL    bool // Polynomial multiplication instruction set
HasSHA1     bool // SHA1 hardware implementation
HasSHA2     bool // SHA2 hardware implementation
HasCRC32    bool // CRC32 hardware implementation
```

As I look around, I see code detecting CPU features based on the `runtime.goarm` value (which is set by the GOARM environment variable at link time), rather than a runtime check.  This means that:

1. As `runtime.goarm` is not `const`, the fast-path (e.g. using NEON) and slow-path fallback are being compiled into the binary, but only one path can **ever** be used.  It would be nice if both paths can be used via run-time detection instead.
2. Using the above, one cannot have a "universal binary" that is especially problematic on Android.

In one of my projects, I have resorted to parsing `/proc/cpuinfo` for run-time detection of NEON, which only works on Linux.  I'd love to instead use the standard library.
Repository: flutter
Issue: `AnimatedSize` crops widgets on resize
Labels: framework,a: animation,a: quality,has reproducible steps,P2,found in release: 3.3,found in release: 3.7,team-framework,triaged-framework

I placed a `RaisedButton` inside an `AnimatedSize`, but when the widget is recreated the `AnimatedSize` is clipping the `RaisedButton` during the animation.

[Here you can see what's happening](https://imgur.com/a/0aInqLf)

My code is:

```dart
AnimatedSize(
  vsync: this,
  duration: Duration(milliseconds: 200),
  child: RaisedButton(
	onPressed: model.isStepValid() ?
		() => model.onNextStepRequested()
		: null,
	shape: StadiumBorder(),
	color: Theme.of(context).primaryColor,
	child: Row(
	  children: <Widget>[
		if (model.isLoading)
		  SizedBox(
			height: 30,
			width: 30,
			child: Padding(
			  padding: const EdgeInsets.only(right: 12, top: 6, bottom: 6),
			  child: CircularProgressIndicator(
				backgroundColor: Colors.white,
				strokeWidth: 2.0,
			  ),
			),
		  ),
		Text(
		  model.isFinalStep ? 'Finalizar' : 'Próximo',
		  style: TextStyle(color: Colors.white),
		),
	  ],
	),
  ),
)
```

If I wrap the `RaisedButton` in a `Padding` the problem goes away, but this messes all layout, as I don't want any padding there.
Repository: youtube-dl
Issue: How to identify a music video on YouTube or if a video is copyrighted?
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 check if a YouTube video is copyrighted? I'm specifically talking about music videos, is there any data that let us identify a music video? I have checked another similar issue, the answer was to check the `license` key, but this key will be available for all the videos and won't help us identify a music video.

Any suggested solution to find a music video? Like `artist`, `creator` or any other data?

Thank you.
Repository: rust
Issue: Rust with [no_std] & CustomAllocator -> rust_oom either undefined in link stage or already defined in compile stage :/
Labels: A-linkage,A-allocators,T-compiler,C-bug,O-bare-metal

Hi there,

i'm a bit new to rust and writing a library for embedded Raspberry Pi bare metal programming. I'm completely using ``#![no_std]`` in all of my crates. However, at a certain point functions of the ``alloc`` crate are needed. So I came accross the option to implement a custom ``GlobalAllocator`` as per the doc: (https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc.html).

However, when compiling this the crate also requires an ``alloc_error_handler`` present like so:
```
#![no_std]
#![feature(alloc_error_handler)]

#[global_allocator]
static ALLOCATOR: RusPiRoAllocator = RusPiRoAllocator;
[...] here comes the implementation of the allocator [...]
#[alloc_error_handler]
fn alloc_error_handler(_: Layout) -> ! {
    // TODO: how to handle memory allocation errors?
    loop { }
}
```
However, doing so compilation works fine, but using this crate in an actual binary to be build as a dependency lead to the linker error ``undefined reference to 'rust_oom'``.

So well I just put this into the code as well:
```
#[alloc_error_handler]
fn alloc_error_handler(_: Layout) -> ! {
    // TODO: how to handle memory allocation errors?
    loop { }
}

#[no_mangle]
fn rust_oom() -> ! {
    // well, currently there is nothing we could do on out-of-memory other than halt the core
    loop { }
}
```
BUT, doing so the compiler complains that the function ``rust_oom`` has already being defined. So for whatever reason the compiler seem to optimize the ``rust_oom`` function away before linking. As a workaround I put the ``rust_oom`` function into a separate crate the allocator crate depends on. (you can find the whole code here: [ruspiro-allocator](https://github.com/RusPiRo/ruspiro-allocator/).

With this workaround in place the building of the binary works fine as long as the ``ruspiro-allocator`` crate is a direct dependency of it. I would rather like to bundle other crates of mine into a new crate that makes it easier to consume and may need only one dependency in the binary to be created with some feature gates but not many...

So I created a crate, lets call it ``kernel-crate`` that represents the final binary to be build. This crate has a dependency to a ``library-crate`` which depends on ``allocator-crate``.
In this scenario the linker will again complain that the reference to ``rust_oom`` is undefined. So somewhere down the route the function seem to be optimized away again...
But if ``kernel-crate`` directly depends on ``allocator-crate`` everything works fine....

I would appreciate if someone could shed a light on the issue and how to solve it properly.

Btw. I'm building for the target ``armv7-unknown-linux-gnueabihf``, cross compiling from a windows host machine with cargo version:
```
cargo 1.38.0-nightly (677a180f4 2019-07-08)
```

Any hint would be much appreciated...
Thanks in advance.
Repository: pytorch
Issue: torch.nn.DataParallel causes incorrect gradients
Labels: oncall: distributed,module: autograd,triaged

# Bug Report
## Issue description

I have a model which has two nn.Conv2d modules, and I only use the first one of them in 'forward'.

In general, after executing 'loss.backward()', all weights' gradients of the second Conv2d (the unused one) should be 'None'.

Without nn.DataParallel, I got the correct result (conv2.weight.grad is None).

However with nn.DataParallel, the conv2.weight.grad is a zero tensor instead of None. So that if I run optimizer.step() after backward, weight_decay and momentum will be accumulated for the unused parameters, which causes unexpected results. I hope those gradients of unused parameters keep 'None' instead of a zero tensor. 

I have a sample fix for this issue temporarily, but that might cause other problems (when real p.grad = zeros).
```python
loss.backward()
for p in model.parameters():
    if torch.sum(torch.abs(p)) == 0.0:
        p.grad = None
optimizer.step()
```

So why does this problem occur? And how to fix it correctly?

## Code example

See https://gist.github.com/xiaoguai0992/db8742c3fa7a5e02be36e64180693752

The output of the code should be:
```bash
Testing non-dataparallel.
conv1.weight, p.grad is None = False
conv1.bias, p.grad is None = False
conv2.weight, p.grad is None = True
conv2.bias, p.grad is None = True
Testing dataparallel
module.conv1.weight, p.grad is None = False
module.conv1.bias, p.grad is None = False
module.conv2.weight, p.grad is None = False
module.conv2.bias, p.grad is None = False
Testing repaired version
module.conv1.weight, p.grad is None = False
module.conv1.bias, p.grad is None = False
module.conv2.weight, p.grad is None = True
module.conv2.bias, p.grad is None = True
```

## System Info
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176

OS: Ubuntu 16.04.6 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
CMake version: version 3.5.1

Python version: 3.5
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration: 
GPU 0: GeForce RTX 2080 Ti
GPU 1: GeForce RTX 2080 Ti
GPU 2: GeForce RTX 2080 Ti
GPU 3: GeForce RTX 2080 Ti

Nvidia driver version: 418.40.04
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.16.2
[pip3] torch==1.1.0
[pip3] torchvision==0.2.2.post3
[conda] Could not collect
Repository: pytorch
Issue: Improve the performance of linear algebra operations in CUDA for small problem sizes
Labels: module: performance,module: cuda,triaged,module: linear algebra

## Issue description

MAGMA has been the primary backend for specialized linear algebra operations on CUDA devices in PyTorch for a while. MAGMA is extremely effective for large problem sizes (with some routines also supporting batching) than cuSolver or cuBLAS, but while it comes to small problem sizes, we see extremely regressive behavior.

This is behavior is so regressive that, for specific problem size ranges, LAPACK outperforms MAGMA by several orders of magnitude.

This issue is created to discuss certain ways to overcome this regression, and solutions are outlined below. Details of these proposed solutions will be posted in a short while.

## Solutions

1. Implicitly offload computation to CPU, and move the result to GPU.
  - This is adopted internally in MAGMA for the symeig routine. Here, we propose that we compute the result using LAPACK calls, and then move the results to the GPU using a `.to` call.
2. Modify the backend based on problem size (e.g. cuSolver instead of MAGMA).
  - cuSolver has Jacobi based routines for SVD and Symmetric Eigendecomposition, which are inherently faster than divide and conquer routine used, especially for small problem sizes. We could consider using these instead of MAGMA routines.

These solutions are ordered in the ascending order of difficulty. If you have any other solutions that you would like to propose, please share them.

cc: @soumith @jacobrgardner @Balandat

cc @vishwakftw @SsnL
Repository: go
Issue: proposal: update proposal/README.md to stand alone
Labels: Proposal

The proposal process document at https://golang.org/s/proposal has at least two problems we should fix.

First, it incorporates a few talks by reference, but most people aren't going to read/watch those or take away what we want to take away. It's fine to keep the talk links but we should extract the important messages and say them in the README explicitly.

Second, we introduced new process for Go 2 changes, with two rounds of proposals, in the [Go 2 here we come blog post](https://blog.golang.org/go2-here-we-come), but this is not mentioned in the README.
Repository: kubernetes
Issue: Allow setting ownership on mounted secrets
Labels: sig/storage,kind/feature,help wanted,priority/important-longterm

<!-- Please only use this template for submitting enhancement requests -->

**What would you like to be added**:
Currently, you can set secret file permissions, but not ownership: (see the "Secret files permissions" section) 
https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets

It would be good to add a `defaultOwner`, and possible `defaultGroup` field that would allow setting the default ownership of the secret files.

**Why is this needed**:
It is possible that there is more than one process running in a container, each running as a different user. (think `processA` running as `userA` and `processB` running as `userB`). `processA` might need to use `secretA` and `processB` to use `secretB`. 

To make the secrets usable today, `secretA` and `secretB` would need to be world-readable, because there is no way to set ownership on them. This is undesirable from the security standpoint, as `processA` could read `secretB` and vice versa.
Repository: pytorch
Issue: [jit] Python @property's not supported in TorchScript
Labels: oncall: jit,triaged,quantization_release_1.3,jit-backlog

These are used in nn.quantized.modules, ex:

https://github.com/pytorch/pytorch/blob/master/torch/nn/quantized/modules/linear.py#L116

cc @suo