Skip to content

Commit d5bb8f4

Browse files
Merge pull request #56 from jfrog/bugfix/INST-1982
Bugfix/inst 1982 - Fix bash backspace,arrow issue, top, ps and updated curl with https
2 parents a358bb6 + 0aae5d4 commit d5bb8f4

File tree

13 files changed

+124
-24
lines changed

13 files changed

+124
-24
lines changed

Diff for: WORKSPACE

+14-18
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,21 @@ package_manager_repositories()
3333

3434
## This is from release debian repo, the problem is that the Package.gz change so need to update chacksume all the time
3535

36-
3736
## Snapshot repo has folder that Package.gz don't change
3837
dpkg_src(
3938
name = "debian_buster",
4039
arch = "amd64",
4140
distro = "buster",
42-
sha256 = "996001ca07a8ea54c4d54539de7ed96d1d2cb1a2c0a3040c1be8fa89820f6bff",
43-
snapshot = "20190224T095432Z",
44-
url = "https://deepscan.jfrog.io/deepscan/debian/archive",
41+
sha256 = "e096054471ae9a772fa67006cd0d9a0b125bb30443625fb6b66935e2a9331e98",
42+
snapshot = "20210216T210840Z",
43+
url = "https://snapshot.debian.org/archive",
4544
)
4645

4746
dpkg_src(
4847
name = "debian_buster_security",
49-
package_prefix = "https://deepscan.jfrog.io/deepscan/debian/archive/debian-security/20190131T235445Z/",
50-
packages_gz_url = "https://deepscan.jfrog.io/deepscan/debian/archive/debian-security/20190131T235445Z/dists/buster/updates/main/binary-amd64/Packages.gz",
51-
sha256 = "f61f27bd17de546264aa58f40f3aafaac7021e0ef69c17f6b1b4cd7664a037ec",
48+
package_prefix = "https://snapshot.debian.org/archive/debian-security/20210216T201258Z/",
49+
packages_gz_url = "https://snapshot.debian.org/archive/debian-security/20210216T201258Z/dists/buster/updates/main/binary-amd64/Packages.gz",
50+
sha256 = "979b105c890ce629a002d66c79b67381c5b78b4769abbeddad3a57225c1c1159",
5251
)
5352

5453
dpkg_list(
@@ -57,6 +56,7 @@ dpkg_list(
5756
# Version required to skip a security fix to the pre-release library
5857
# TODO: Remove when there is a security fix or dpkg_list finds the recent version
5958
"libc6",
59+
"libc-bin",
6060
"base-files",
6161
"ca-certificates",
6262
"openssl",
@@ -89,6 +89,8 @@ dpkg_list(
8989
"db-util",
9090
"db5.3-util",
9191
"libdb5.3",
92+
"libncurses6",
93+
"ncurses-base",
9294
],
9395
# Takes the first package found: security updates should go first
9496
# If there was a security fix to a package before the stable release, this will find
@@ -121,25 +123,19 @@ http_file(
121123
urls = ["https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64"],
122124
)
123125

124-
#http_file(
125-
# name = "busybox",
126-
# executable = True,
127-
# sha256 = "5776b1f4fbff641eb09024483fde28467e81bc74118c0c65ce5a8ad7a1029063",
128-
# urls = ["https://busybox.net/downloads/binaries/1.30.0-i686/busybox"],
129-
#)
130-
#use this fixed version for this issue https://github.com/GoogleContainerTools/distroless/issues/225
131126
http_file(
132127
name = "busybox",
133128
executable = True,
134-
sha256 = "af052caf38fe81eae321005c5c151650d64714bbe0a3f5e1f7cb39ba179cf7d6",
135-
urls = ["https://deepscan.jfrog.io/deepscan/distroless-generic/busybox/1.30.0-glibc-busybox.tar.xz"],
129+
sha256 = "9c1cc2735e2ea21c4579be452b313ce4120866a8c2b9dfc45bb7f9bf02d34949",
130+
urls = ["https://deepscan.jfrog.io/deepscan/distroless-generic/busybox/1.32.1-glibc-busybox.tar.xz"],
136131
)
132+
137133
#Added complied and slimed curl binary from source https://github.com/curl/curl/releases
138134
http_file(
139135
name = "curl",
140136
executable = True,
141-
sha256 = "cfd3c343c8730e2d03565800a8736a75ac7f6abea323081465b520a61db5c9b1",
142-
urls = ["https://deepscan.jfrog.io/deepscan/distroless-generic/curl/curl-7.71.0-linux.tar.gz"],
137+
sha256 = "2d7237ec551fbe1a7ddaa8ede3aea5390fa354f6e2b45ccd65209e2d6c67290b",
138+
urls = ["https://deepscan.jfrog.io/deepscan/distroless-generic/curl/curl-7.74.0-linux.tar.gz"],
143139
)
144140
# Docker rules.
145141
git_repository(

Diff for: base/BUILD

+8
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ pkg_tar(
4646

4747
load("@package_bundle//file:packages.bzl", "packages")
4848
load("//cacerts:cacerts.bzl", "cacerts")
49+
load("//locale:locale.bzl", "locale")
4950

5051
cacerts(
5152
name = "cacerts",
5253
deb = packages["ca-certificates"],
5354
)
5455

56+
locale(
57+
name = "locale",
58+
deb = packages["libc-bin"],
59+
)
60+
5561
# Create /tmp, too many things assume it exists.
5662
# tmp.tar has a /tmp with the correct permissions 01777
5763
# A tar is needed because at the moment there is no way to create a
@@ -63,6 +69,7 @@ docker_build(
6369
packages["base-files"],
6470
packages["netbase"],
6571
packages["tzdata"],
72+
packages["libc-bin"],
6673
":cacerts.deb",
6774
],
6875
env = {
@@ -71,6 +78,7 @@ docker_build(
7178
# TODO: We should run update-ca-certifaces, but that requires "openssl rehash"
7279
# which would probably need to be run inside the container
7380
"SSL_CERT_FILE": "/etc/ssl/certs/ca-certificates.crt",
81+
"LANG": "C.UTF-8",
7482
},
7583
tars = [
7684
":passwd",

Diff for: base/artifactory-sh/BUILD

+8
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,18 @@ pkg_tar(
6363

6464
load("@package_bundle//file:packages.bzl", "packages")
6565
load("//cacerts:cacerts.bzl", "cacerts")
66+
load("//locale:locale.bzl", "locale")
6667

6768
cacerts(
6869
name = "cacerts",
6970
deb = packages["ca-certificates"],
7071
)
7172

73+
locale(
74+
name = "locale",
75+
deb = packages["libc-bin"],
76+
)
77+
7278
# Create /tmp, too many things assume it exists.
7379
# tmp.tar has a /tmp with the correct permissions 01777
7480
# A tar is needed because at the moment there is no way to create a
@@ -100,6 +106,8 @@ docker_build(
100106
packages["zlib1g"],
101107
packages["libstdc++6"],
102108
packages["libgcc1"],
109+
packages["libncurses6"],
110+
packages["ncurses-base"],
103111
],
104112
stamp = True,
105113
tars = [

Diff for: base/distribution-sh/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ docker_build(
8484
packages["zlib1g"],
8585
packages["libstdc++6"],
8686
packages["libgcc1"],
87+
packages["libncurses6"],
88+
packages["ncurses-base"],
8789
],
8890
stamp = True,
8991
tars = [

Diff for: base/insight-sh/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ docker_build(
102102
packages["zlib1g"],
103103
packages["libstdc++6"],
104104
packages["libgcc1"],
105+
packages["libncurses6"],
106+
packages["ncurses-base"],
105107
],
106108
stamp = True,
107109
tars = [

Diff for: base/jfmc-sh/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ docker_build(
8585
packages["zlib1g"],
8686
packages["libstdc++6"],
8787
packages["libgcc1"],
88+
packages["libncurses6"],
89+
packages["ncurses-base"],
8890
],
8991
stamp = True,
9092
tars = [

Diff for: base/router-go/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ docker_build(
8282
packages["zlib1g"],
8383
packages["libstdc++6"],
8484
packages["libgcc1"],
85+
packages["libncurses6"],
86+
packages["ncurses-base"],
8587
],
8688
stamp = True,
8789
tars = [

Diff for: base/testdata/debug.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ fileExistenceTests:
77
commandTests:
88
- name: busybox
99
command: ["/busybox/busybox"]
10-
expectedOutput: ['BusyBox v1\.30\.1']
10+
expectedOutput: ['BusyBox v1\.32\.1']
1111
- name: busybox-owner
1212
command: ["ls","-ld","/busybox"]
1313
expectedOutput: ['drwxr-xr-x 2 root root']
14-
# Check curl version 7.71.0 installed
14+
# Check curl version 7.74.0 installed
1515
- name: curl version
1616
command: ["curl", "--version"]
1717
exitCode: 0
18-
expectedOutput: ['curl 7\.71\.0']
18+
expectedOutput: ['curl 7\.74\.0']
1919
- name: curl
2020
command: ["curl","-h"]
2121
expectedOutput: ['Usage: curl \[options\.\.\.\] <url>']
22+
# Check top cmd
23+
- name: top
24+
command: ["top", "-n", "1", "-b"]
25+
exitCode: 0
26+
# Check ps cmd
27+
- name: ps
28+
command: ["ps"]
29+
exitCode: 0

Diff for: base/xray-go/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ docker_build(
8585
packages["db-util"],
8686
packages["db5.3-util"],
8787
packages["libdb5.3"],
88+
packages["libncurses6"],
89+
packages["ncurses-base"],
8890
],
8991
tars = [
9092
":passwd",

Diff for: java/BUILD

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ package(default_visibility = ["//visibility:public"])
33
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_build")
44
load("@package_bundle//file:packages.bzl", "packages")
55
load("//cacerts:java.bzl", "cacerts_java")
6+
load("//locale:locale.bzl", "locale")
67
load("@io_bazel_rules_docker//java:image.bzl", "java_image")
78

89
cacerts_java(
910
name = "cacerts_java",
1011
)
1112

13+
locale(
14+
name = "locale",
15+
deb = packages["libc-bin"],
16+
)
17+
1218
docker_build(
1319
name = "java-base",
1420
base = "//cc:debug",
1521
debs = [
1622
packages["zlib1g"],
23+
packages["libc-bin"],
1724
packages["net-tools"],
1825
packages["libprocps7"],
1926
packages["procps"],
@@ -34,12 +41,16 @@ docker_build(
3441
packages["dash"],
3542
packages["libtinfo6"],
3643
packages["libstdc++6"],
37-
packages["libgcc1"]
44+
packages["libgcc1"],
45+
packages["libncurses6"],
46+
packages["ncurses-base"],
3847
],
3948
stamp = True,
4049
entrypoint = ["/busybox/sh"],
41-
42-
tars = [":cacerts_java"],
50+
env = {
51+
"LANG": "C.UTF-8",
52+
},
53+
tars = [":cacerts_java",":locale",],
4354
)
4455

4556
docker_build(

Diff for: locale/BUILD

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
sh_binary(
4+
name = "extract_locale",
5+
srcs = ["extract.sh"],
6+
)

Diff for: locale/extract.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
DEB=$1
6+
OUT_TAR=$2
7+
8+
ar -x "$DEB" data.tar.xz
9+
10+
tar -xf data.tar.xz ./usr/lib/locale/C.UTF-8 ./usr/share/doc/libc-bin/copyright
11+
12+
rm data.tar.xz
13+
14+
# On Mac OS, you need to make sure that GNU Tar is used instead of the BSD tar that is shipped with MacOS.
15+
# To resolve this you can install gnu-tar via Homebrew and symlink it as /usr/local/bin/tar.
16+
tar -c --owner=0 --group=0 -f locale.tar ./usr
17+
18+
mv locale.tar "$OUT_TAR"
19+
20+
rm -rf usr

Diff for: locale/locale.bzl

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""A rule to unpack c locale from the debian package."""
2+
3+
def _impl(ctx):
4+
ctx.actions.run(
5+
executable = ctx.executable._extract,
6+
arguments = [
7+
ctx.file.deb.path,
8+
ctx.outputs.tar.path,
9+
],
10+
inputs = [ctx.file.deb],
11+
outputs = [ctx.outputs.tar],
12+
)
13+
14+
locale = rule(
15+
attrs = {
16+
"deb": attr.label(
17+
allow_single_file = [".deb"],
18+
mandatory = True,
19+
),
20+
# Implicit dependencies.
21+
"_extract": attr.label(
22+
default = Label("//locale:extract_locale"),
23+
cfg = "host",
24+
executable = True,
25+
allow_files = True,
26+
),
27+
},
28+
executable = False,
29+
outputs = {
30+
"tar": "%{name}.tar",
31+
},
32+
implementation = _impl,
33+
)

0 commit comments

Comments
 (0)