winlnk 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/winlnk.rb +5 -1
  3. data/test/test_error.rb +7 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62d79fd0022714edcf75ebca7c62d4618ee7bec8
4
- data.tar.gz: a415b7a951b807ce1024668944ee2d1b040c8556
3
+ metadata.gz: c52a14179cd99db83990b3049ae63b89ee6006d5
4
+ data.tar.gz: c6cce9bbedcfab5fa31fa378d362c64f5ec58da8
5
5
  SHA512:
6
- metadata.gz: 4ac603dfe9b4097ab7107703f60ad73f82c69b83b0dec231145291a6354dc258d03fa6a3f56e6ab18a978cfd2217824ef9b9acdd0d338043a8aa0245ab006d33
7
- data.tar.gz: 5c5c25772657a052a916c310b8481dc0f8b2e07ecb76b2f9b71d0af461e9ff7374523498d639679d43bdaf3c8dd24473389b37db40fbab4ee365ff9dd2cd3b38
6
+ metadata.gz: 31ea40e3dac00f53847902b298e665c468216300f104906c2156a4346e152608d172ab11375b5d46d59556f0675d062b0f69a4c4ab7e2b9adf8d96b533bbd6a4
7
+ data.tar.gz: b27805ec219caf048a8d9a1abcfca585e1130e7e9af144fb435339c83087ef31662061bc35deacd557e3cf7fbf82701df201daeb466ebfa8f435d998739507f1
@@ -29,6 +29,7 @@
29
29
  class WinLnk
30
30
  MAGIC = "\x4c\x00\x00\x00".b
31
31
  CLSID = "\x01\x14\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46".b
32
+ private_constant :MAGIC, :CLSID
32
33
 
33
34
  FLAG_HAS_LINK_TARGET_ID_LIST = 1 << 0
34
35
  FLAG_HAS_LINK_INFO = 1 << 1
@@ -99,7 +100,10 @@ class WinLnk
99
100
  # to be +codepage+.
100
101
  def initialize(pathname, codepage)
101
102
  @codepage = codepage
102
- @data = open(pathname, "rb:ASCII-8BIT") { |f| f.read }
103
+ # Do not use Kernel.#open or File.read, which is actually IO.read,
104
+ # because they can open pipes. File.read was fixed to not open pipes
105
+ # in Ruby 2.6.
106
+ @data = File.open(pathname, mode: "rb:ASCII-8BIT") { |f| f.read }
103
107
  off = read_header()
104
108
  printf("Link flags: %b\n", @flags) if @@debug
105
109
 
@@ -39,4 +39,11 @@ class TestError < Test::Unit::TestCase
39
39
  WinLnk.new("test/test_error.rb", "US-ASCII")
40
40
  end
41
41
  end
42
+
43
+ def test_no_popen
44
+ # Pipes should not be opened.
45
+ assert_raise(Errno::ENOENT) do
46
+ WinLnk.new("|echo Hello", "US-ASCII")
47
+ end
48
+ end
42
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winlnk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - KAMADA Ken'ichi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  This is a library to parse Windows Shell Link (shortcut or .lnk) files