sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: path/filepath: fix HasPrefix
Labels: NeedsInvestigation

The [`filepath.HasPrefix`](https://golang.org/pkg/path/filepath/#HasPrefix) function has been in a deprecated-like status for the past 4 years (since 2012). The reasons why it was deprecated is described in [CL/5712045](http://golang.org/cl/5712045). The issue with respecting path boundaries is probably the most significant.

Given that it's had a note steering people away for 4 years, there should be nearly no users of the function. Inside Google, there are 3 uses of it and all of them would have wanted the correct implementation. We should actually fix this function and bring it out of deprecated status.

The challenge with properly implementing it is getting the case-sensitivity correct. This is a dependent on the underlying filesystem and not the GOOS.
Repository: rust
Issue: method resolution problem related to `Box<dyn Trait>`
Labels: A-type-system,A-associated-items,T-compiler,C-bug,T-types,A-trait-objects

To reproduce:
```rust
use std::ops::{Deref, DerefMut};
use std::borrow::BorrowMut;

pub enum Managed<'a, T: 'a + ?Sized> {
    Borrowed(&'a mut T),
    Owned(Box<BorrowMut<T>>)
}

impl<'a, T: 'a + ?Sized> Deref for Managed<'a, T> {
    type Target = T;

    fn deref(&self) -> &T {
        match self {
            &Managed::Borrowed(ref value) => value,
            &Managed::Owned(ref value) => value.borrow()
        }
    }
}

impl<'a, T: 'a + ?Sized> DerefMut for Managed<'a, T> {
    fn deref_mut(&mut self) -> &mut T {
        match self {
            &mut Managed::Borrowed(ref mut value) => value,
            &mut Managed::Owned(ref mut value) => value.borrow_mut()
        }
    }
}
```
If you comment the impl DerefMut, everything compiles. If you uncomment it:
```
error[E0277]: the trait bound `Box<std::borrow::BorrowMut<T> + 'static>: std::borrow::Borrow<T>` is not satisfied
  --> <anon>:24:57
   |
24 |             &mut Managed::Owned(ref mut value) => value.borrow_mut()
   |                                                         ^^^^^^^^^^ trait `Box<std::borrow::BorrowMut<T> + 'static>: std::borrow::Borrow<T>` not satisfied
   |
   = help: the following implementations were found:
   = help:   <Box<T> as std::borrow::Borrow<T>>
```

which seems clearly nonsensical.

Changing `value.borrow_mut()` to `(**value).borrow_mut()` fixes it.
Repository: opencv
Issue: [traincascade] fail faster for missing output directory
Labels: feature,category: apps

##### System information (version)
- OpenCV => 3.1
- Operating System / Platform => Linux Mint 18.1 x64
- Compiler => gcc

##### Detailed description
If a non-existent directory is supplied to the `traincascade` program it will eventually crash when trying to save the first training stage. Training a stage can take hours and it kind of sucks to have it crash because you forgot to create a directory. I think it would be worth checking the directory before starting to train the classifier.

I am opening the issue mainly to get guidance on the preferred way to handle this issue since there are a lot of things I am not familiar with here like cross platform issues and dependencies. [This](http://stackoverflow.com/questions/18100097/portable-way-to-check-if-directory-exists-windows-linux-c) stack overflow seems to indicate that `sys/stat.h` might work and there is also `boost::filesystem`.

Alternatively the training program could be modified to try and save the parameters immediately which would help to fail fast.

##### Steps to reproduce
Start the `traincascade` program and supply a non-existent directory to `-data`. Wait until the first stage is ready to save and observe the crash.
Repository: go
Issue: image/png: no support for setting and retrieving the PPI/DPI
Labels: help wanted,NeedsFix,FeatureRequest

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.7.4 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/raphaelgeronimi/Local/Others/Go workspace"
GORACE=""
GOROOT="/opt/local/lib/go"
GOTOOLDIR="/opt/local/lib/go/pkg/tool/darwin_amd64"
CC="/usr/bin/clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zw/0zvr11l11975vn4gk7s4hrx00000gn/T/go-build732769753=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

I need to mass-produce PNG chart images in high resolution - i.e., PPI at 2x-4x multiple of the default 72 value

What did you expect to see?

A new encoding method and/or an Options field to customize the PPI of the image being encoded. Similarly, extending the image.Config struct to be able to retrieve the PPI of a decoded image.

What did you see instead?

No method found.

I wrote a patch with the missing code. However the public API design needs to be discussed first as a "clean" API - i.e., adding an Options field to the Encode function to perfectly mirror the design of image/jpeg - is unfeasible as it would break the Go 1 compatibility
Repository: opencv
Issue: VideoCapture hangs immediately after starting
Labels: bug,category: videoio,platform: ios/osx

- OpenCV 3.1
- Mac OSX Sierra 10.12.1
- xcode 8.1

hello, I've installed also opencv_contrib, everything looks good, but it seems my first program hangs immediately after the first frame was displayed if I try to capture video from the webcam. 

First I've tried the code in Reading and Writing Images and Video example and it hangs.

```
#include "opencv2/opencv.hpp"
using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
  
    if(!cap.isOpened())  // check if we succeeded
        return -1;
    Mat edges;
    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if(waitKey(30) >= 0) break;
    }
    return 0;
}
```

so I've found this next example and it works fine.

```
#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char**)
{
    int c;
    IplImage* color_img;
    CvCapture* cv_cap = cvCaptureFromCAM(0);
    cvNamedWindow("Video",0); // create window
    for(;;) {
        color_img = cvQueryFrame(cv_cap); // get frame
        if(color_img != 0)
            cvShowImage("Video", color_img); // show frame
        c = cvWaitKey(10); // wait 10 ms or for key stroke
        if(c == 27)
            break; // if ESC, break and quit
    }
    /* clean up */
    cvReleaseCapture( &cv_cap );
    cvDestroyWindow("Video");    // the camera will be deinitialized automatically in VideoCapture destructor
    
    return 0;
}
```

so why VideoCapture hangs? Is it some my mistake? I don't have any error messages everything is building successfully.

Can anyone help me?

Thanks in advance!
Repository: rust
Issue: Repeated #[link] attributes for the same library cause it to be passed as many times to the linker.
Labels: A-linkage,C-enhancement,T-compiler

> [If I specify #[link(name="pythonXY")] on 30 extern C blocks, and then compile with rustc -l dylib=pythonXY:python27, then python27.lib is passed to the linker 30 times.](https://github.com/rust-lang/rust/issues/37403#issuecomment-267763227)

In extreme cases this may cause trouble on Windows, where the maximum length of the command line is 32000 bytes.  Also, may slow down linking.
Repository: youtube-dl
Issue: Support vk audio search
Labels: request,account-needed

It would be very good, if you add support to get list mp3 tracks from VK, link example: https://m.vk.com/audio?act=search&q=daydreamer
Repository: rust
Issue: Tracking issue for the `msp430-interrupt` calling convention/ABI
Labels: T-lang,B-unstable,C-tracking-issue,WG-embedded,S-tracking-needs-summary,O-msp430,A-hardware-interrupts

Added in #38465

This calling convention is used to define interrup handlers on MSP430 microcontrollers. Usage looks like this:

``` rust
#[no_mangle]
#[link_section = "__interrupt_vector_10"]
pub static TIM0_VECTOR: unsafe extern "msp430-interrupt" fn() = tim0;

unsafe extern "msp430-interrupt" fn tim0() {
  P1OUT.write(0x00);
}
```

which generates the following assembly:

``` asm
Disassembly of section __interrupt_vector_10:

0000fff2 <TIM0_VECTOR>:
    fff2:       10 c0           interrupt service routine at 0xc010

Disassembly of section .text:

0000c010 <_ZN3msp4tim017h3193b957fd6a4fd4E>:
    c010:       c2 43 21 00     mov.b   #0,     &0x0021 ;r3 As==00
    c014:       00 13           reti
        ...
```

cc @alexcrichton @pftbest
Repository: go
Issue: x/crypto/acme: Rejected TOS results in inability to register
Labels: NeedsInvestigation

Please answer these questions before submitting your issue. Thanks!

### What version of Go are you using (`go version`)?
1.6

### What operating system and processor architecture are you using (`go env`)?
amd64

### What did you do?
Call acme.Register with a prompt that returns false, then again with a prompt that succeeds.

### What did you expect to see?
Success

### What did you see instead?
Register returns a conflict without calling UpdateReg.
Repository: You-Dont-Know-JS
Issue: You Don't Know JS: Types & Grammar Chapter 2: Values
Labels: for second edition

The text: 'Addition and subtraction cannot result in a negative zero' is not absolute. An edge case is with -0 + -0 = -0. Ditto for the subtraction case.

The ES5 spec contains this rule: https://es5.github.io/#x11.6.3
Repository: You-Dont-Know-JS
Issue: "types & grammar": fix inaccuracy in ch5 about completion values
Labels: for second edition

Fix discussion of `var x` statement having `undefined` completion value. RE: https://twitter.com/ydkjs/status/811247502762606592

thanks @allenwb for helping me identify a years-old mistake! :)
Repository: go
Issue: cmd/go: provide a way to resolve an import path to a vcs, url, etc.
Labels: NeedsInvestigation,FeatureRequest,GoCommand

'go get' contains non-trivial logic to figure out how to obtain a package based on its import path, including consulting a list of well-known hosting providers and checking for html meta tags. There is no way to get this information other than actually doing the 'go get', or maintaining a non-trivial fork of a subset of cmd/go.

I'd like a way to get this information from cmd/go. Ideally it would be a library, a la package go/build, but a command line invocation would work as well, perhaps something accepting a format flag:

```bash
$ go get -resolve '{{.ImportPath}} {{.URL}} {{.IsCustom}} {{.VCS}} {{.Root}} and probably some vcs commands...' custom.xyz/pkg
```

or perhaps emitting JSON, with one entry per import path.

I asked for this originally at https://github.com/golang/go/issues/18119#issuecomment-267094257. I noted there that @rogpeppe also wants this; see https://go-review.googlesource.com/8725. Another partial copy of this bit of cmd/go can be found at https://github.com/sdboyer/gps (e.g. https://github.com/sdboyer/gps/blob/master/discovery.go).
Repository: TypeScript
Issue: add codefix for extracting an interface from an object literal
Labels: Suggestion,Awaiting More Feedback,Domain: Refactorings

given an anonimous object literal, allow extracting interface by looking at the effective types of the values of the properties
Repository: TypeScript
Issue: Flow analysis doesn't work with es6 collections 'has' method
Labels: Suggestion,Awaiting More Feedback

**TypeScript Version:**  2.1.1 

**Code**

```ts
const x = new Map<string, string>();
x.set("key", "value");
if (x.has("key")) {
  const y : string = x.get("key");  // error: y is string | undefined, not string
}


```

**Expected behavior:**
y is narrowed down to string
**Actual behavior:**
y is still string | undefined even after checking if the map has that key
Repository: rust
Issue: question mark and `try!` obscure type inference errors
Labels: C-enhancement,A-diagnostics,T-compiler,A-inference,D-confusing

```rust
use std::num::ParseIntError;

fn run() -> Result<(), ParseIntError> {
    let v = vec![1,2,3];

    let x = "1".parse()?;
    
    println!("{:?}", v[x]);    
    Ok(())
}

fn main() {
    let _ = run();
}
```


has the confusing error message
```
error[E0277]: the trait bound `(): std::str::FromStr` is not satisfied
 --> <anon>:6:17
  |
6 |     let x = "1".parse()?;
  |                 ^^^^^ the trait `std::str::FromStr` is not implemented for `()`

error[E0277]: the trait bound `std::vec::Vec<i32>: std::ops::Index<()>` is not satisfied
 --> <anon>:8:22
  |
8 |     println!("{:?}", v[x]);
  |                      ^^^^ the trait `std::ops::Index<()>` is not implemented for `std::vec::Vec<i32>`
  |
  = note: the type `std::vec::Vec<i32>` cannot be indexed by `()`
```

replacing the `?` with `.unwrap()` gives a nicer explanation of the problem (`try!` gives the same error message as `?`)

```
error[E0282]: unable to infer enough type information about `_`
 --> <anon>:6:9
  |
6 |     let x = "1".parse().unwrap();
  |         ^ cannot infer type for `_`
  |
  = note: type annotations or generic parameter binding required
```
Repository: TypeScript
Issue: Abstract class type argument inference
Labels: Suggestion,Committed,Domain: JavaScript

It would be good if TypeScript can infer the type of an extended class of an generic abstract class:

```ts
abstract class A<T> {
    abstract a: T;
    get(): T {
        return '' as any;
    }
}

class B extends A {
    a: 'helloworld';
}

const b = new B():
b.get(); // string
```
In a similar fashion, it does inference elsewhere.
Repository: rust
Issue: Specialization does not find the default impl
Labels: A-specialization,C-bug,F-specialization

```rust
#![feature(specialization)]

struct JsonSerializer;
struct CborSerializer;

fn main() {
    0i32.serialize(&mut CborSerializer);
}

trait Serialize<S: Serializer> {
    fn serialize(&self, _: &mut S);
}

trait Serializer {}
impl Serializer for JsonSerializer {}
impl Serializer for CborSerializer {}

impl<S: Serializer> Serialize<S> for i32 {
    default fn serialize(&self, _: &mut S) {
        println!("default");
    }
}

impl Serialize<JsonSerializer> for i32 {
    fn serialize(&self, _: &mut JsonSerializer) {
        println!("specialized");
    }
}
```

## Expected:

Compiles and prints out "default". This is the behavior if you comment out the `impl Serialize<JsonSerializer> for i32`.

## Actual:

```
rustc 1.15.0-nightly (71c06a56a 2016-12-18)
error[E0308]: mismatched types
 --> <anon>:7:20
  |
7 |     0i32.serialize(&mut CborSerializer);
  |                    ^^^^^^^^^^^^^^^^^^^ expected struct `JsonSerializer`, found struct `CborSerializer`
  |
  = note: expected type `&mut JsonSerializer`
  = note:    found type `&mut CborSerializer`
```
Repository: rust
Issue: test::black_box for big size T?
Labels: T-libs-api,C-feature-accepted

I'm not sure if this is a bug or not, but I noticed that FB Folly has two versions of `doNotOptimizeAway`

https://github.com/facebook/folly/blob/1c098e2758d1bd55c48ffa26dab389dbbe96a666/folly/Benchmark.h#L308

```C++
asm volatile("" ::"r"(datum));
asm volatile("" ::"m"(datum) : "memory");
```

First one for size <= long, second one for larger sizes.  Where as our `test::black_box` only has the first version.  Is the second one needed?
Repository: three.js
Issue: Revert FileLoader-based ImageLoader 
Labels: Loaders

The initial idea was to gain support for progress events in `ImageLoader` but the side effects have been so far:

1. Security issues. #9826
2. data: urls no longer working. https://github.com/mrdoob/three.js/commit/0576c7c80c472beb67c855031975aa7708175370
3. Some people (A-Frame) relied on image.src being a file path for their tests.
4. CrossOrigin not working. #10168
5. SVG no longer loading. #10363

So, for the time being, I think it'll be better to revert and, instead, try to convince W3C people to provide load progress events for `Image`.
Repository: opencv
Issue: SVD performance issue
Labels: bug,category: core

##### System information (version)
- OpenCV => 3.1
- Operating System / Platform => Ubuntu 16.10 64 Bit
- Compiler => gcc 6.2

##### Detailed description

On some particular dataset, the method `cv::SVD::compute()` can take hours where the equivalent eigen method takes only seconds. The enclosed program + data can reproduce the problem.

Note that the performance does not seem to be related to the data volume as I can't reproduce 
the issue on a (500 000 x 6) matrix initialized with random values.

##### Steps to reproduce

Example to run OpenCV and Eigen SVD decompositions on same data.

```.cpp
#include <iostream>

#include "eigen3/Eigen/Core"
#include "eigen3/Eigen/SVD"

#include <opencv2/opencv.hpp>
#include <opencv2/core/eigen.hpp>

cv::Mat load(const std::string & p_filePath)
{
  cv::Mat mat;
  cv::FileStorage fs;
  if (!fs.open(p_filePath, cv::FileStorage::READ))
    {
      std::cout << "Can't open matrix file" << std::endl;
      return cv::Mat();
    }
  fs["matrix"] >> mat;
  fs.release();
  return mat;
}

int main (void)
{
  cv::Mat src = load("svd_src.xml"); // input (rows: 6 ; cols: 515 808 ; type: CV_64FC1)
  cv::Mat u; // output
  

  // Eigen implementation
  Eigen::MatrixXd m;
  cv::cv2eigen(src, m);

  std::cout << "[start] Eigen SVD decomposition" << std::endl;
  Eigen::JacobiSVD<Eigen::MatrixXd> svd(m, Eigen::ComputeThinU);
  std::cout << "[end] Eigen SVD decomposition" << std::endl;
    
  cv::eigen2cv(svd.matrixU(), u);


  // OpenCV implementation
  cv::Mat w, vt;
  std::cout << "[start] OpenCV SVD decomposition" << std::endl;
  cv::SVD::compute(src, w, u, vt);
  std::cout << "[end] OpenCV SVD decomposition" << std::endl;

  return 0;
}

```

[svd.zip](https://github.com/opencv/opencv/files/668549/svd.zip)
Repository: TypeScript
Issue: Decorated private propoerty flagged as unused with `noUnusedLocals:true`
Labels: Suggestion,Awaiting More Feedback

noUnusedLocals:true

    import { Component } from '@angular/core';

    @Component({
      selector: 'my-component',
      template: `
        {{text}}
      `,
    })
    export class MyComponent {
      @Input()
      private text: string;//'text' is declared but never used
    }
Repository: rust
Issue: Allow access to location information from proc_macro TokenStreams
Labels: T-libs-api,C-feature-request,A-proc-macros

I would like to build a template engine that leverages custom derive to attach a template rendering function to a struct at compile time. I was planning on attaching an attribute to the struct to specify the path to the template file, which could then be read and transpiled into Rust. However, it seems it is currently not possible to get at the path to the source file where the `TokenStream` originated. As such, it seems I would have to rely on absolute paths to template files or on the current working directory. Even assuming cargo compiles (including workspaces), this does not seem reliable.

The `Item`s that are part of the `TokenStream` contain a `Span`, but I don't think the `CodeMap` they index into is currently available to a proc_macro. Would that be a viable implementation strategy?
Repository: youtube-dl
Issue: [FEATURE REQUEST] - Item exclusion from playlist download and tweaks
Labels: request,bug

If I want to download all the playlists of a given channel but one, I have to put all their links in the command, it would be way more convenient to just put the playlist section of that channel and then add the link of the one I want to ignore with an exclusion command. I think downloading playlists should be more _"tweakable"_ since various scenarios can present.
Repository: rust
Issue: Randomize the ordering of struct fields when compiling in debug mode
Labels: T-compiler,C-feature-request,A-reproducibility

Now that it looks like https://github.com/rust-lang/rust/issues/28951 will be addressed via https://github.com/rust-lang/rust/issues/37429 , we may have a further obligation to ensure to do what we can to ensure that this doesn't bite people. One way that we could help out would be to randomize the order of struct fields by default when compiling in debug mode. This would only apply to structs that are not tagged with a `#repr`, and would effectively act as the `#[repr(random)]` proposed by @petrochenkov at https://github.com/rust-lang/rust/pull/37429#issuecomment-260080723 (actually adding explicit `#[repr(random)]` would probably require an RFC, and so is not a prereq for this issue).
Repository: TypeScript
Issue: Support for type destructuring
Labels: Suggestion,In Discussion

**TypeScript Version:**  2.1.4

**Code**

```ts
import { MyNamespace } from 'my-package';

// importing Class objects:
const { NavLink, NavGroup } = MyNamespace; // VALID

// if we want the types as well:
type { NavLink, NavGroup } = MyNamespace; // NOT VALID

// So we have to go manual: 
type NavLink = MyNamespace.NavLink;  // VALID
type NavGroup = MyNamespace.NavLink;  // VALID
```

**Expected behavior:**
Being able to use destructuring for types same as we use for objects.

**Actual behavior:**
Can only use destructuring for objects.
Repository: go
Issue: net/http/cgi: support Python etc non-executable scripts on Windows
Labels: help wanted,OS-Windows,NeedsInvestigation

Please answer these questions before submitting your issue. Thanks!

### What version of Go are you using (`go version`)?
1.7.4

### What operating system and processor architecture are you using (`go env`)?
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GORACE=
set GOROOT=D:\Go
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

### What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

[cgidemo.zip](https://github.com/golang/go/files/670407/cgidemo.zip)
Change to unziped directory, and execute `go run cgi.go`, then visit http://localhost:8000/cgi-bin/test.py

### What did you expect to see?

Hello on my browser

### What did you see instead?
The page hangs up