profile
viewpoint
Leandro A. F. Pereira lpereira @Microsoft Seattle, WA https://tia.mat.br

fiorix/freegeoip 4689

IP geolocation web server

lpereira/hardinfo 348

System profiler and benchmark tool for Linux systems

lpereira/gomoku 331

Gomoku compiles Go code to C++

lpereira/finf 52

FINF Is Not Forth

LIS/LISAv2 25

Microsoft Linux Test Automation Framework on multi-platforms. LISAv2 is under maintenance mode, and LISAv3 is under development for more platform supports and features.

lpereira/GW-BASIC 20

Porting GW-BASIC from 8086 back to the Z80

lpereira/infect-to-protect 15

Infect to Protect

lpereira/compilador-tosco 7

Compilador Sub-Pascal

lpereira/help-viewer 2

Simple help viewer based on Markdown syntax and GTK+

issue commentlpereira/lwan

make

I don't know what's the issue here. I don't have a Ubuntu 18.04 environment setup here to test this right now. Can you do me a favor and see if you can build a Debug build? (Use a different build directory or at least remove CMakeCache.txt from the build directory you used for the Release build.)

littleforce163

comment created time in 6 hours

issue commentlpereira/lwan

Possible NULL pointer dereference on function unsigned int parse_time_period(const char *str, unsigned int default_value)

Thanks for the report. However, this is impossible to happen in this situation: if sscanf() returns 2, multiplier (set by sscanf()) is guaranteed to be in the string pointed to by str, so strchr() won't ever return NULL here. Unless I'm missing something, though.

ycaibb

comment created time in 6 hours

issue closedlpereira/lwan

Can we use MSYS2 to build or is not supported?

Both cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release and cmake .. -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release does not work.

https://github.com/nanomsg/nng works with MSYS2.

MINGW64 /c/Users/Johan/Documents/lwan/build
$ cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 10.1.0
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Running CMake for lwan (Scalable, high performance, experimental web server)
-- Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version "0.29.2")
-- Found ZLIB: C:/msys64/mingw64/lib/libz.dll.a (found version "1.2.11")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Checking for modules 'luajit>=2.0;luajit<=2.0.999'
--   No package 'luajit' found
--   No package 'luajit' found
-- Checking for modules 'lua>=5.1.0;lua<=5.1.999'
--   No package 'lua' found
--   No package 'lua' found
-- Checking for modules 'lua51>=5.1.0;lua51<=5.1.999'
--   No package 'lua51' found
--   No package 'lua51' found
-- Checking for modules 'lua5.1>=5.1.0;lua5.1<=5.1.999'
--   No package 'lua5.1' found
--   No package 'lua5.1' found
-- Checking for modules 'lua-5.1>=5.1.0;lua-5.1<=5.1.999'
--   No package 'lua-5.1' found
--   No package 'lua-5.1' found
-- Disabling Lua support
-- Checking for modules 'libbrotlienc;libbrotlidec;libbrotlicommon'
--   Found libbrotlienc, version 1.0.7
--   Found libbrotlidec, version 1.0.7
--   Found libbrotlicommon, version 1.0.7
-- Checking for module 'libzstd'
--   Found libzstd, version 1.4.4
-- Using built-in context switching routines for AMD64 processors
-- Looking for linux/capability.h
-- Looking for linux/capability.h - not found
-- Looking for sys/auxv.h
-- Looking for sys/auxv.h - not found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - not found
-- Looking for 3 include files sys/time.h, ..., sys/event.h
-- Looking for 3 include files sys/time.h, ..., sys/event.h - not found
-- Looking for alloca.h
-- Looking for alloca.h - not found
-- Looking for get_current_dir_name
-- Looking for get_current_dir_name - not found
-- Looking for reallocarray
-- Looking for reallocarray - not found
-- Looking for mempcpy
-- Looking for mempcpy - found
-- Looking for memrchr
-- Looking for memrchr - not found
-- Looking for pipe2
-- Looking for pipe2 - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for readahead
-- Looking for readahead - not found
-- Looking for mkostemp
-- Looking for mkostemp - not found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for pthread_barrier_init
-- Looking for pthread_barrier_init - found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Looking for eventfd
-- Looking for eventfd - not found
-- Looking for posix_fadvise
-- Looking for posix_fadvise - not found
-- Looking for getentropy
-- Looking for getentropy - not found
-- Looking for fwrite_unlocked
-- Looking for fwrite_unlocked - not found
-- Looking for gettid
-- Looking for gettid - not found
-- Looking for secure_getenv
-- Looking for secure_getenv - not found
-- Looking for dladdr
-- Looking for dladdr - not found
-- Performing Test HAVE_STD_GNU99
-- Performing Test HAVE_STD_GNU99 - Success
-- Performing Test HAVE_BUILTIN_CPU_INIT
-- Performing Test HAVE_BUILTIN_CPU_INIT - Success
-- Performing Test HAVE_BUILTIN_CLZLL
-- Performing Test HAVE_BUILTIN_CLZLL - Success
-- Performing Test HAVE_BUILTIN_FPCLASSIFY
-- Performing Test HAVE_BUILTIN_FPCLASSIFY - Success
-- Performing Test HAVE_BUILTIN_MUL_OVERFLOW
-- Performing Test HAVE_BUILTIN_MUL_OVERFLOW - Success
-- Performing Test HAVE_BUILTIN_ADD_OVERFLOW
-- Performing Test HAVE_BUILTIN_ADD_OVERFLOW - Success
-- Performing Test HAVE_STATIC_ASSERT
-- Performing Test HAVE_STATIC_ASSERT - Success
-- Valgrind headers not found -- disabling valgrind support
-- Performing Test HAVE_MTUNE_NATIVE
-- Performing Test HAVE_MTUNE_NATIVE - Success
-- Performing Test HAVE_MARCH_NATIVE
-- Performing Test HAVE_MARCH_NATIVE - Success
-- Performing Test HAVE_STACK_PROTECTOR_EXPLICIT
-- Performing Test HAVE_STACK_PROTECTOR_EXPLICIT - Success
-- Performing Test HAVE_IMMEDIATE_BINDING
-- Performing Test HAVE_IMMEDIATE_BINDING - Success
-- Performing Test HAVE_READ_ONLY_GOT
-- Performing Test HAVE_READ_ONLY_GOT - Success
-- Performing Test HAVE_NO_PLT
-- Performing Test HAVE_NO_PLT - Success
-- Performing Test HAVE_NOEXEC_STACK
-- Performing Test HAVE_NOEXEC_STACK - Success
-- Performing Test HAVE_ALIGN_FNS
-- Performing Test HAVE_ALIGN_FNS - Success
-- Performing Test HAVE_NO_SEMANTIC_INTERPOSITION
-- Performing Test HAVE_NO_SEMANTIC_INTERPOSITION - Success
-- Performing Test HAVE_ALIGN_DATA
-- Performing Test HAVE_ALIGN_DATA - Success
-- Performing Test HAVE_NO_ASYNC_UNWIND_TABLES
-- Performing Test HAVE_NO_ASYNC_UNWIND_TABLES - Success
-- Performing Test HAVE_LTO_JOBSERVER
-- Performing Test HAVE_LTO_JOBSERVER - Success
-- Performing Test HAVE_LTO_FAT_OBJS
-- Performing Test HAVE_LTO_FAT_OBJS - Success
-- Performing Test HAVE_BUILTIN_IA32_CRC32
-- Performing Test HAVE_BUILTIN_IA32_CRC32 - Success
-- Performing Test supports -Wduplicated-cond
-- Performing Test supports -Wduplicated-cond - Success
-- Performing Test supports -Wduplicated-branches
-- Performing Test supports -Wduplicated-branches - Success
-- Performing Test supports -Wlogical-op
-- Performing Test supports -Wlogical-op - Success
-- Performing Test supports -Wrestrict
-- Performing Test supports -Wrestrict - Success
-- Performing Test supports -Wdouble-promotion
-- Performing Test supports -Wdouble-promotion - Success
-- Performing Test supports -Wno-unused-parameter
-- Performing Test supports -Wno-unused-parameter - Success
-- Performing Test supports -Wstringop-truncation
-- Performing Test supports -Wstringop-truncation - Success
-- Performing Test supports -Wvla
-- Performing Test supports -Wvla - Success
-- Performing Test supports -Wunsequenced
-- Performing Test supports -Wunsequenced - Failed
-- Performing Test supports -Wno-free-nonheap-object
-- Performing Test supports -Wno-free-nonheap-object - Success
-- Found PythonInterp: C:/msys64/mingw64/bin/python3.exe (found suitable version "3.8.2", minimum required is "3")
-- Using Brotli for mimegen
-- Checking for module 'sqlite3>=3.6.20'
--   Found sqlite3, version 3.31.1
-- Not building benchmark suite: database libraries not found.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Johan/Documents/lwan/build

MINGW64 /c/Users/Johan/Documents/lwan/build
$ mingw32-make.exe
Scanning dependencies of target bin2hex
[  1%] Building C object src/bin/tools/CMakeFiles/bin2hex.dir/bin2hex.c.obj
In file included from C:\Users\Johan\Documents\lwan\src\bin\tools\bin2hex.c:24:
C:/Users/Johan/Documents/lwan/src/lib/missing/sys/mman.h:21:15: fatal error: sys/mman.h: No such file or directory
   21 | #include_next <sys/mman.h>
      |               ^~~~~~~~~~~~
compilation terminated.
mingw32-make[2]: *** [src\bin\tools\CMakeFiles\bin2hex.dir\build.make:83: src/bin/tools/CMakeFiles/bin2hex.dir/bin2hex.c.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:521: src/bin/tools/CMakeFiles/bin2hex.dir/all] Error 2
mingw32-make: *** [Makefile:149: all] Error 2

MINGW64 /c/Users/Johan/Documents/lwan/build

closed time in 3 days

KenthJohan

issue commentlpereira/lwan

Can we use MSYS2 to build or is not supported?

Closing the issue -- feel free to reopen if you have more questions about this subject

KenthJohan

comment created time in 3 days

issue closedlpereira/lwan

Put LWAN on TechEmpower Framework Benchmark again :3

To boost LWAN's popularity!

https://github.com/TechEmpower/FrameworkBenchmarks/issues/4147

closed time in 3 days

kokizzu

startedvinibiavatti1/TuiCss

started time in 4 days

startednpjg/classic.css

started time in 4 days

push eventlpereira/lwan

Leandro Pereira

commit sha e9fe1271c169ecbdadf02b190981f0324bc9d4b2

It's UB if a function has signature `bool is[a-z]+(...)`

view details

Leandro Pereira

commit sha 20f1ff5b32f3d42274030d4a8c49ee53e1e14fad

Always define CLOCK_MONOTONIC and CLOCK_MONOTONIC_COARSE Even on systems that don't support this, like old macOS systems, so that the fallback implementation can use time() instead -- even if not monotonic, it's the best I can do without using platform-specific APIs.

view details

push time in 4 days

push eventlpereira/lwan

Leandro Pereira

commit sha 29583a5ee6150c9550f089c8ae86d721a5fea4b8

config_fuzzer: Also fuzz bool/long/int/time parsing functions

view details

Leandro Pereira

commit sha 702c0fb90d91df7518de3a07074cff2f5f754500

Comment the need for LWAN_NO_DISCARD()

view details

Leandro Pereira

commit sha 1cb6bce9188fa3368d692a8458450fd94947bf94

Simplify slightly how messages are published in pub/sub

view details

Leandro Pereira

commit sha 6b69ccc567eed523e2377974dfe7a8c8d8c56b36

Make graceful_close() only yield the WANT_READ hint This ensures that all yield points will notify the scheduler that that particular coroutine will be performing read operations, regardless of what it previously did.

view details

push time in 4 days

pull request commentLIS/LISAv2

Initial LISAv3 via Pytest review

@squirrelsc, from what I've seen from this PR is that you can bend PyTest the way you want; it's very maleable. A lot of the features we need that were not part of the core PyTest were implemented with little to no code. In the unlikelihood we find a feature we can't implement using PyTest's extension hooks, we can modify PyTest to do this and contribute it back -- as is customary in any healthy open source project.

By leveraging documentation that was already written, code that was already debugged, and tooling that already exists, we can focus our development (and, most importantly, maintenance) efforts on things that are specific to LISA.

andschwa

comment created time in 6 days

pull request commentLIS/LISAv2

Initial LISAv3 via Pytest review

Agreed, Chi. I think a good subproduct of the LISAv3 effort is a table of package equivalency between distros; start small with a hardcoded table, but look for ways to automate the maintenance the future. (I had part of that automation before, which used the source tarball hash digest from Debian packages to match the hash digest for Clear Linux. Not easy to do if you don’t have all the tarballs in a convenient place to calculate their hash digest using the same algorithm that another distro uses, though. This would be valuable for other use cases as well.)

From: Chi Song notifications@github.com Date: Wednesday, October 21, 2020 at 3:25 PM To: LIS/LISAv2 LISAv2@noreply.github.com Cc: Leandro Pereira Leandro.Pereira@microsoft.com, Mention mention@noreply.github.com Subject: Re: [LIS/LISAv2] Initial LISAv3 via Pytest review (#1065)

@squirrelsc commented on this pull request.


In pytest/testsuites/test_lis.pyhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLIS%2FLISAv2%2Fpull%2F1065%23discussion_r509755873&data=04|01|leandro.pereira%40microsoft.com|9249df14528d4868e92008d876102738|72f988bf86f141af91ab2d7cd011db47|1|0|637389159035594362|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=iEHYwyFbKaPdQDrTlHgda4tX1IDje6G2JRRwxmARwLM%3D&reserved=0:

+import conftest

+import pytest

+from node_plugin import Node

+@pytest.mark.lisa(

  • platform="Azure", category="Functional", area="LIS_DEPLOY", tags=["lis"], priority=0

+)

+# @pytest.mark.deploy(setup="OneVM")

+@pytest.mark.connect("centos")

+def test_lis_driver_version(node: Node) -> None:

  • TODO: Include “utils.sh” automatically? Or something...

  • for f in ["utils.sh", "LIS-VERSION-CHECK.sh"]:

  •    node.put(conftest.LINUX_SCRIPTS / f)
    
  •    node.run(f"chmod +x {f}")
    
  • node.sudo("yum install -y bc")

It was proven our of maintain in LISAv2, if test case calls commands directly. The command may have different behaviors on different platform. The package installation has more difference among distros, from behaviors to package names. LISAv2 handles different distros behavior in test cases level, that makes a test case works on only tested distro, not other distros. It's one of reason that test cases failed a lot.

In my mind, a test case should focus on test logic. It's hard to achieve, but we can have a try on decouple difference of distros and tools.

I haven't provide comments on test case level, because it's a PoC. It's not key things in this one. So several hello world cases are enough to prove pytest can support test case flow control.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLIS%2FLISAv2%2Fpull%2F1065%23discussion_r509755873&data=04|01|leandro.pereira%40microsoft.com|9249df14528d4868e92008d876102738|72f988bf86f141af91ab2d7cd011db47|1|0|637389159035594362|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=iEHYwyFbKaPdQDrTlHgda4tX1IDje6G2JRRwxmARwLM%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAADVGJRETD6DGPQ4ZHKCVTSL5NT3ANCNFSM4S2JGYRA&data=04|01|leandro.pereira%40microsoft.com|9249df14528d4868e92008d876102738|72f988bf86f141af91ab2d7cd011db47|1|0|637389159035604358|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=dAKJgdwJc3LTrAquu%2FFVl%2BpGaAF35jfrsVYH91pptig%3D&reserved=0.

andschwa

comment created time in 7 days

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs a 'smoke' test for an Azure Linux VM deployment."""+import logging+import socket+import time++from invoke.runners import CommandTimedOut, Result, UnexpectedExit  # type: ignore+from paramiko import SSHException  # type: ignore++import pytest+from node_plugin import Node++# TODO: This is an example of leveraging Pytest’s parameterization+# support. We can implement a small YAML parser to read a playbook at+# runtime to generate this instead of using the below list.+params = [+    pytest.param(i, marks=pytest.mark.deploy(vm_image=i, vm_size="Standard_DS2_v2"))+    for i in [+        "citrix:netscalervpx-130:netscalerbyol:latest",+        "audiocodes:mediantsessionbordercontroller:mediantvirtualsbcazure:latest",+        "credativ:Debian:9:9.0.201706190",+        "github:github-enterprise:github-enterprise:latest",+    ]+]+++@pytest.mark.parametrize("urn", params)+@pytest.mark.flaky(reruns=1)+def test_smoke(urn: str, node: Node) -> None:+    """Check that a VM can be deployed and is responsive.++    1. Deploy the VM (via 'node' fixture) and log it.+    2. Ping the VM.+    3. Connect to the VM via SSH.+    4. Attempt to reboot via SSH, otherwise use the platform.+    5. Fetch the serial console logs.++    For commands where we expect a possible non-zero exit code, we+    pass 'warn=True' to prevent it from throwing 'UnexpectedExit' and+    we instead check its result at the end.++    SSH failures DO NOT fail this test.++    """+    logging.info("Pinging before reboot...")+    ping1 = Result()+    try:+        ping1 = node.ping()+    except UnexpectedExit:+        logging.warning(f"Pinging {node.host} before reboot failed")++    ssh_errors = (TimeoutError, CommandTimedOut, SSHException, socket.error)++    try:+        logging.info("SSHing before reboot...")+        node.open()+    except ssh_errors as e:+        logging.warning(f"SSH before reboot failed: '{e}'")++    reboot_exit = 0+    try:+        logging.info("Rebooting...")+        # If this succeeds, we should expect the exit code to be -1+        reboot_exit = node.sudo("reboot", timeout=5).exited+    except ssh_errors as e:+        logging.warning(f"SSH failed, using platform to reboot: '{e}'")+        node.platform_restart()+    except UnexpectedExit:+        # TODO: How do we differentiate reboot working and the SSH+        # connection disconnecting for other reasons?+        if reboot_exit != -1:+            logging.warning("While SSH worked, 'reboot' command failed")++    logging.info("Sleeping for 10 seconds after reboot...")+    time.sleep(10)

Ah, gotcha.

andschwa

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs 'FunctionalTests-XDP.xml' using Pytest."""+++import conftest+import pytest+from node_plugin import Node+++@pytest.mark.lisa(+    platform="Azure",+    category="Functional",+    area="XDP",+    tags=["xdp", "network", "hv_netvsc", "sriov"],+    priority=0,+)+@pytest.mark.deploy(+    setup="OneVM2NIC",+    networking="SRIOV",+    vm_image="Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest",+    vm_size="Standard_DS4_v2",+)+@pytest.mark.skip(reason="Not Finished")+def test_verify_xdp_compliance(node: Node) -> None:+    for f in [+        "utils.sh",+        "XDPDumpSetup.sh",+        "XDPUtils.sh",+        "enable_passwordless_root.sh",+        "enable_root.sh",+    ]:+        node.put(conftest.LINUX_SCRIPTS / f)+        node.run(f"chmod +x {f}")

Maybe we should revisit how these scripts are copied? Maybe something like having a node.put_files([...], mode=...) or something of the sort?

andschwa

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Pytest plugin implementing a Node fixture for running remote commands."""+from __future__ import annotations++import json+import logging+import platform+import typing+from io import BytesIO+from uuid import uuid4++import fabric  # type: ignore+import invoke  # type: ignore+from fabric import Connection+from invoke import Context+from invoke.runners import Result  # type: ignore+from tenacity import retry, stop_after_attempt, wait_exponential  # type: ignore++import pytest++if typing.TYPE_CHECKING:+    from typing import Any, Dict, Iterator, Optional, Tuple++    from _pytest.fixtures import FixtureRequest++# Setup a sane configuration for local and remote commands. Note that+# the defaults between Fabric and Invoke are different, so we use+# their Config classes explicitly.+config = {+    "run": {+        # Show each command as its run.+        "echo": True,+        # Disable stdin forwarding.+        "in_stream": False,+        # Don’t let remote commands take longer than five minutes+        # (unless later overridden). This is to prevent hangs.+        "command_timeout": 1200,+    }+}+++# Provide a configured local Invoke context for running commands+# before establishing a connection. (Use like `local.run(...)`).+invoke_config = invoke.Config(overrides=config)+local = Context(config=invoke_config)+++def check_az_cli() -> None:+    """Assert that the `az` CLI is installed and logged in."""+    # E.g. on Ubuntu: `curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash`+    assert local.run("az --version", warn=True), "Please install the `az` CLI!"+    # TODO: Login with service principal (az login) and set+    # default subscription (az account set -s) using secrets.+    account: Result = local.run("az account show")+    assert account.ok, "Please `az login`!"+    sub = json.loads(account.stdout)+    assert sub["isDefault"], "Please `az account set -s <subscription>`!"+    logging.info(+        f"Using account '{sub['user']['name']}' with subscription '{sub['name']}'"+    )+++def create_boot_storage(location: str) -> str:+    """Create a separate resource group and storage account for boot diagnostics."""+    account = "pytestbootdiag"+    # This command always exits with 0 but returns a string.+    if local.run("az group exists -n pytest-lisa").stdout.strip() == "false":+        local.run(f"az group create -n pytest-lisa --location {location}")+    if not local.run(f"az storage account show -g pytest-lisa -n {account}", warn=True):+        local.run(f"az storage account create -g pytest-lisa -n {account}")

I assume that things like pytestbootdiag and pytest-lisa are hardcoded here just as a POC, right?

andschwa

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs a 'smoke' test for an Azure Linux VM deployment."""+import logging+import socket+import time++from invoke.runners import CommandTimedOut, Result, UnexpectedExit  # type: ignore+from paramiko import SSHException  # type: ignore++import pytest+from node_plugin import Node++# TODO: This is an example of leveraging Pytest’s parameterization+# support. We can implement a small YAML parser to read a playbook at+# runtime to generate this instead of using the below list.+params = [+    pytest.param(i, marks=pytest.mark.deploy(vm_image=i, vm_size="Standard_DS2_v2"))+    for i in [+        "citrix:netscalervpx-130:netscalerbyol:latest",+        "audiocodes:mediantsessionbordercontroller:mediantvirtualsbcazure:latest",+        "credativ:Debian:9:9.0.201706190",+        "github:github-enterprise:github-enterprise:latest",+    ]+]+++@pytest.mark.parametrize("urn", params)+@pytest.mark.flaky(reruns=1)+def test_smoke(urn: str, node: Node) -> None:+    """Check that a VM can be deployed and is responsive.++    1. Deploy the VM (via 'node' fixture) and log it.+    2. Ping the VM.+    3. Connect to the VM via SSH.+    4. Attempt to reboot via SSH, otherwise use the platform.+    5. Fetch the serial console logs.++    For commands where we expect a possible non-zero exit code, we+    pass 'warn=True' to prevent it from throwing 'UnexpectedExit' and+    we instead check its result at the end.++    SSH failures DO NOT fail this test.++    """+    logging.info("Pinging before reboot...")+    ping1 = Result()+    try:+        ping1 = node.ping()+    except UnexpectedExit:+        logging.warning(f"Pinging {node.host} before reboot failed")++    ssh_errors = (TimeoutError, CommandTimedOut, SSHException, socket.error)++    try:+        logging.info("SSHing before reboot...")+        node.open()+    except ssh_errors as e:+        logging.warning(f"SSH before reboot failed: '{e}'")++    reboot_exit = 0+    try:+        logging.info("Rebooting...")+        # If this succeeds, we should expect the exit code to be -1+        reboot_exit = node.sudo("reboot", timeout=5).exited+    except ssh_errors as e:+        logging.warning(f"SSH failed, using platform to reboot: '{e}'")+        node.platform_restart()+    except UnexpectedExit:+        # TODO: How do we differentiate reboot working and the SSH

If /tmp is a tmpfs (which is common), you can write a file there and check if it's not there after the reboot, for instance. Another way would be looking at the value of uptime, although it might be an issue since these machines are spawned to run tests so there's a possibility the values are close enough you can't easily compare them

andschwa

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs a 'smoke' test for an Azure Linux VM deployment."""+import logging+import socket+import time++from invoke.runners import CommandTimedOut, Result, UnexpectedExit  # type: ignore+from paramiko import SSHException  # type: ignore++import pytest+from node_plugin import Node++# TODO: This is an example of leveraging Pytest’s parameterization+# support. We can implement a small YAML parser to read a playbook at+# runtime to generate this instead of using the below list.+params = [+    pytest.param(i, marks=pytest.mark.deploy(vm_image=i, vm_size="Standard_DS2_v2"))+    for i in [+        "citrix:netscalervpx-130:netscalerbyol:latest",+        "audiocodes:mediantsessionbordercontroller:mediantvirtualsbcazure:latest",+        "credativ:Debian:9:9.0.201706190",+        "github:github-enterprise:github-enterprise:latest",+    ]+]+++@pytest.mark.parametrize("urn", params)+@pytest.mark.flaky(reruns=1)+def test_smoke(urn: str, node: Node) -> None:+    """Check that a VM can be deployed and is responsive.++    1. Deploy the VM (via 'node' fixture) and log it.+    2. Ping the VM.+    3. Connect to the VM via SSH.+    4. Attempt to reboot via SSH, otherwise use the platform.+    5. Fetch the serial console logs.++    For commands where we expect a possible non-zero exit code, we+    pass 'warn=True' to prevent it from throwing 'UnexpectedExit' and+    we instead check its result at the end.++    SSH failures DO NOT fail this test.++    """+    logging.info("Pinging before reboot...")+    ping1 = Result()+    try:+        ping1 = node.ping()+    except UnexpectedExit:+        logging.warning(f"Pinging {node.host} before reboot failed")++    ssh_errors = (TimeoutError, CommandTimedOut, SSHException, socket.error)++    try:+        logging.info("SSHing before reboot...")+        node.open()+    except ssh_errors as e:+        logging.warning(f"SSH before reboot failed: '{e}'")++    reboot_exit = 0+    try:+        logging.info("Rebooting...")+        # If this succeeds, we should expect the exit code to be -1+        reboot_exit = node.sudo("reboot", timeout=5).exited+    except ssh_errors as e:+        logging.warning(f"SSH failed, using platform to reboot: '{e}'")+        node.platform_restart()+    except UnexpectedExit:+        # TODO: How do we differentiate reboot working and the SSH+        # connection disconnecting for other reasons?+        if reboot_exit != -1:+            logging.warning("While SSH worked, 'reboot' command failed")++    logging.info("Sleeping for 10 seconds after reboot...")+    time.sleep(10)

Might be better to have a "try running this command again and again every 100ms until it succeeds or we reach a timeout of 10s" instead; this should cut down should the system take less time to come back online

andschwa

comment created time in 7 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs a 'smoke' test for an Azure Linux VM deployment."""+import logging+import socket+import time++from invoke.runners import CommandTimedOut, Result, UnexpectedExit  # type: ignore+from paramiko import SSHException  # type: ignore++import pytest+from node_plugin import Node++# TODO: This is an example of leveraging Pytest’s parameterization+# support. We can implement a small YAML parser to read a playbook at+# runtime to generate this instead of using the below list.+params = [+    pytest.param(i, marks=pytest.mark.deploy(vm_image=i, vm_size="Standard_DS2_v2"))+    for i in [+        "citrix:netscalervpx-130:netscalerbyol:latest",+        "audiocodes:mediantsessionbordercontroller:mediantvirtualsbcazure:latest",+        "credativ:Debian:9:9.0.201706190",+        "github:github-enterprise:github-enterprise:latest",+    ]+]+++@pytest.mark.parametrize("urn", params)+@pytest.mark.flaky(reruns=1)+def test_smoke(urn: str, node: Node) -> None:+    """Check that a VM can be deployed and is responsive.++    1. Deploy the VM (via 'node' fixture) and log it.+    2. Ping the VM.+    3. Connect to the VM via SSH.+    4. Attempt to reboot via SSH, otherwise use the platform.+    5. Fetch the serial console logs.++    For commands where we expect a possible non-zero exit code, we+    pass 'warn=True' to prevent it from throwing 'UnexpectedExit' and+    we instead check its result at the end.++    SSH failures DO NOT fail this test.++    """+    logging.info("Pinging before reboot...")+    ping1 = Result()+    try:+        ping1 = node.ping()+    except UnexpectedExit:+        logging.warning(f"Pinging {node.host} before reboot failed")++    ssh_errors = (TimeoutError, CommandTimedOut, SSHException, socket.error)++    try:+        logging.info("SSHing before reboot...")+        node.open()+    except ssh_errors as e:+        logging.warning(f"SSH before reboot failed: '{e}'")++    reboot_exit = 0+    try:+        logging.info("Rebooting...")+        # If this succeeds, we should expect the exit code to be -1+        reboot_exit = node.sudo("reboot", timeout=5).exited

Arbitrary timeouts like this often lead to flaky tests

andschwa

comment created time in 7 days

Pull request review commentLIS/LISAv2

Initial LISAv3 via Pytest review

+"""Runs 'LIS-Tests.xml' using Pytest."""+import conftest+import pytest+from node_plugin import Node+++@pytest.mark.lisa(+    platform="Azure", category="Functional", area="LIS_DEPLOY", tags=["lis"], priority=0+)+# @pytest.mark.deploy(setup="OneVM")+@pytest.mark.connect("centos")+def test_lis_driver_version(node: Node) -> None:+    # TODO: Include “utils.sh” automatically? Or something...+    for f in ["utils.sh", "LIS-VERSION-CHECK.sh"]:+        node.put(conftest.LINUX_SCRIPTS / f)+        node.run(f"chmod +x {f}")+    node.sudo("yum install -y bc")

One thing I'd like to see in node is a way to quote arguments properly. Using f-strings is quite dangerous and can lead to issues that are well hidden and tricky to find.

Maybe an interface that would allow one to do something like:

node.chmod("+x", f)

Or

node.as_root.yum("install", "-y", "bc")

Would be better than relying on f-strings for this?

(__getitem__() can be overloaded to implement these.)

andschwa

comment created time in 7 days

PullRequestReviewEvent

push eventLIS/LISAv2

Leandro Pereira

commit sha 319fcda6fca320691763a3af4a0f5e56a4eec04a

Implement test XML -> PyTest stub generator The `import_xml_testcases.py` tool will generate stub files that are compatible with PyTest from the test cases XML present in a LISAv2 checkout.

view details

push time in 12 days

push eventLIS/LISAv2

Leandro Pereira

commit sha 8124fd14f585fd3fa66f8b1e4e7cfa1b5fe96751

Implement test XML -> PyTest stub generator The `import_xml_testcases.py` tool will generate stub files that are compatible with PyTest from the test cases XML present in a LISAv2 checkout.

view details

push time in 12 days

startedKDAB/hotspot

started time in 13 days

Pull request review commentlhc/estatuto

Alteração nas regras para uma pessoa se tornar um associada do LHC

 longo de qualquer mandato. Dos Associados ============== -Admissão de novos membros----------------------------1.  O interessado em associar-se ao **LHC** deverá:-    1.  apresentar-se na lista de discussão ou pessoalmente, fornecer informações -        sobre quem é, o que faz, etc;-    2.  encontrar um associado que será seu **mentor**, que deverá-        auxiliá-lo em sua integração;-2.  O **LHC** terá até 3 meses para ratificar a associação do interessado-    em associar-se que tenha cumprido o passo 1 da admissão aqui descrita.-3.  O interessado em associar-se já deverá começar a contribuir com as-    mensalidades.+Admissão de novas associadas e novos associados

Plural no Português acaba levando à palavras no masculino; colocando a versão feminina e masculina aqui acaba excluindo pessoas não-binárias/fluídas. Eu ainda não sei o que penso sobre neopronomes e língua neutra, portanto não sei o que sugerir aqui, mas queria apontar isso.

rennerocha

comment created time in 14 days

PullRequestReviewEvent

pull request commentlpereira/hardinfo

Show graph's title at selecting sensor item

Merged, thanks!

sergiosvieira

comment created time in 19 days

push eventlpereira/hardinfo

Sergio Vieira

commit sha 4d8e68f34fabd3e387df3246cfc69425cea65eed

Show graph's title at selecting sensor item

view details

Leandro Pereira

commit sha 2180e3e38618f648093e3dfcdcd458d6aedad71e

Ensure LoadGraph title is cleared when LG is cleared too

view details

Leandro Pereira

commit sha e4fe32824ffca45c1fb1c408152094a3d4e486ef

Add stub to set title in GTK3 load graph

view details

push time in 19 days

Pull request review commentmicrosoft/CBL-Mariner

Enable valgrind tests for librelp

 make check %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc %changelog-* Sat May 09 00:21:40 PST 2020 Nick Samson <nisamson@microsoft.com> - 1.2.17-6-- Added %%license line automatically-+*   Mon Sep 05 2020 Emre Girgin <mrgirgin@microsoft.com> 1.2.17-7+-   Remove the valgrinf workaround in the check section.
-   Remove the Valgrind workaround in the check section.
mrgirgin

comment created time in 22 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Fixing anti-patterns

 def test_test_result_canrun(self) -> None:             else:                 self.assertEqual(False, result.can_run) -    def test_skip_before_suite_failed(self) -> None:+    async def test_skip_before_suite_failed(self) -> None:

Is the unittest framework designed to work with asyncio? (I really need to read more about asyncio in Python. My head is still stuck in 2.7.)

andschwa

comment created time in 23 days

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Fixing anti-patterns

 Python world. If you make it through even some of these guides, you will be well on your way to being a “Pythonista” (a Python developer) writing “Pythonic” (canonically correct Python) code left and right. +### Async IO++With Python 3.4, the Async IO pattern found in languages such as C# and Go is

Go doesn't really have an async I/O pattern; everything is written as if it were blocking code. The asyncness of it happens under the hood, inside its runtime libraries.

andschwa

comment created time in 23 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventlpereira/lwan

Leandro Pereira

commit sha 263a09c65a4db1e0028c48d5e88035207b5efba2

WebSockets frame validation for long len should consider short max

view details

push time in 23 days

push eventlpereira/lwan

Leandro Pereira

commit sha 324400c7d8b70b7a9246353be416169e55fc1913

Use the reentrant localtime() variant for all clock samples

view details

Leandro Pereira

commit sha d6ace9068ae168a7fe60bb3f4476d230c3f62e7a

Don't let `user` and `chroot` settings to be redefined These are copied to the stack using `strdupa()`, so avoid copying them again if they were set before.

view details

push time in 24 days

push eventlpereira/hardinfo

Leandro A. F. Pereira

commit sha 7665215da2cb168631938465550220be9349bf3a

Fix CodeQL dependency installation line I really wish there were a way to test this kind of stuff without creating commits.

view details

push time in 25 days

push eventlpereira/hardinfo

Leandro A. F. Pereira

commit sha 0961821a827d3edffa1b90146dbf7507b936a369

Install dependencies when running CodeQL workflow

view details

push time in 25 days

issue commentlpereira/lwan

Does not build on platforms where size_t is not 64-bit

This should be fixed. Please reopen if you still see the issue.

angelsl

comment created time in 25 days

push eventlpereira/lwan

Leandro Pereira

commit sha b57e2c3eaa6166041248cd69486d9835bb2296e9

Fix build on 32-bit systems Also provider better validation of WebSockets frame lengths, according to the RFC. Closes #293.

view details

Leandro Pereira

commit sha f7f41068d58e784f2f62a3e98e117b1b5d73c8ef

Reset continuation flag after calling lwan_recv() Otherwise, the ternary operator to choose between no flags or MSG_DONTWAIT won't ever result in no flags being used at all.

view details

push time in 25 days

issue closedlpereira/lwan

Does not build on platforms where size_t is not 64-bit

https://github.com/lpereira/lwan/commit/62a25b122c4af32a3d60287a0a65b3c25f55a24f#diff-94ee1f5fd74ecb92be0520d80665a5a8R124

closed time in 25 days

angelsl

pull request commentLIS/LISAv2

Implement Feature, Notifier and other improvements

No problems for me.

squirrelsc

comment created time in a month

issue commentlpereira/lwan

Does not build on platforms where size_t is not 64-bit

That's because a 64-bit integer is passed to a function that expects a size_t. I'll look into this over the weekend; thanks for reporting. (Will probably set up a 32-bit buildbot instance too.)

angelsl

comment created time in a month

startedhxlnt/Resources

started time in a month

issue commentlpereira/lwan

Does not build on platforms where size_t is not 64-bit

It's been a while since I built Lwan on a 32-bit platform; it used to work fine. Which platform are you on (processor architecture, OS, C library, etc)?

angelsl

comment created time in a month

push eventlpereira/hardinfo

Leandro A. F. Pereira

commit sha f65a10680400d1ef67e021118e5760b3801ad261

Enable security code scanner workflow https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository

view details

push time in a month

push eventlpereira/lwan

Leandro A. F. Pereira

commit sha a0ddcb0336d2de1c3c245e383f07eb0c39e004bb

Enable code scanning workflow https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository

view details

push time in a month

PullRequestReviewEvent

pull request commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

The upstream patch has a lot of issues. We should send them a better patch.

hbeberman

comment created time in a month

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {

Yeah, but this is bad -- this should ask the systemd-ask-password program as part of the system and not what's specified in $PATH, which could be pointing to a program that might steal the user password. We should not apply this patch as it is, and we should warn upstream about this

hbeberman

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {++			fprintf(stderr, "Failed to execute systemd-ask-password: %s\n",++			strerror(errno));++		}++		exit(1);++	}++++	close(fd[1]);++	for (;;) {++		if (offs+1 >= capacity) {

It's better to write this as if (offs >= capacity - 1) to avoid UB in the offs + 1 expression overflowing.

hbeberman

comment created time in a month

PullRequestReviewEvent

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {++			fprintf(stderr, "Failed to execute systemd-ask-password: %s\n",++			strerror(errno));++		}++		exit(1);++	}++++	close(fd[1]);++	for (;;) {++		if (offs+1 >= capacity) {++			fprintf(stderr, "Password too long.\n");++			kill(pid, SIGTERM);++			rc = 1;++			break;++		}++		rc = read(fd[0], input + offs, capacity - offs);++		if (rc == -1) {

This should check if errno == EINTR and retry the loop with continue rather than failing right here.

hbeberman

comment created time in a month

PullRequestReviewEvent

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {++			fprintf(stderr, "Failed to execute systemd-ask-password: %s\n",++			strerror(errno));++		}++		exit(1);++	}++++	close(fd[1]);++	for (;;) {++		if (offs+1 >= capacity) {++			fprintf(stderr, "Password too long.\n");++			kill(pid, SIGTERM);++			rc = 1;++			break;++		}++		rc = read(fd[0], input + offs, capacity - offs);

I don't really like this, as read(2) returns an ssize_t rather than an int. On x86-64 systems, ssize_t is a signed 64-bit integer and int is a 32-bit signed integer.

hbeberman

comment created time in a month

PullRequestReviewEvent

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {++			fprintf(stderr, "Failed to execute systemd-ask-password: %s\n",++			strerror(errno));++		}++		exit(1);++	}++++	close(fd[1]);++	for (;;) {++		if (offs+1 >= capacity) {++			fprintf(stderr, "Password too long.\n");++			kill(pid, SIGTERM);++			rc = 1;++			break;++		}++		rc = read(fd[0], input + offs, capacity - offs);++		if (rc == -1) {++			fprintf(stderr, "Failed to read from pipe: %s\n", strerror(errno));++			rc = 1;++			break;++		}++		if (!rc)++			break;++		offs += rc;++		input[offs] = '\0';++	}++	if (wait(&rc) == -1) {++		fprintf(stderr, "Failed to wait child: %s\n", strerror(errno));++		rc = 1;++		goto out;++	}++	if (!WIFEXITED(rc) || WEXITSTATUS(rc)) {++		rc = 1;++		goto out;++	}++++		rc = 0;++++out:++		close(fd[0]);++		return rc;++}++#endif+++ /*+  * If systemd is running and systemd-ask-password --+  * is available, then use that else fallback on getpass(..)+@@ -1659,35 +1726,22 @@+ 	int is_systemd_running;+ 	struct stat a, b;+ ++	memset(input, 0, capacity);+++ 	/* We simply test whether the systemd cgroup hierarchy is+ 	 * mounted */+ 	is_systemd_running = (lstat("/sys/fs/cgroup", &a) == 0)+ 		&& (lstat("/sys/fs/cgroup/systemd", &b) == 0)+ 		&& (a.st_dev != b.st_dev);+ +-	if (is_systemd_running) {+-		char *cmd, *ret;+-		FILE *ask_pass_fp = NULL;+-+-		cmd = ret = NULL;+-		if (asprintf(&cmd, "systemd-ask-password \"%s\"", prompt) >= 0) {

Yeah, this was really bad.

hbeberman

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentmicrosoft/CBL-Mariner

Patch CVE-2020-14342 in cifs-utils

+diff -Naur cifs-utils-6.8.orig/mount.cifs.c cifs-utils-6.8.mod/mount.cifs.c+--- cifs-utils-6.8.orig/mount.cifs.c	2020-09-30 17:26:48.250924409 -0700++++ cifs-utils-6.8.mod/mount.cifs.c	2020-09-30 17:27:19.002733900 -0700+@@ -1646,6 +1646,73 @@+ 	return 0;+ }+ ++#ifdef ENABLE_SYSTEMD++static int get_passwd_by_systemd(const char *prompt, char *input, int capacity)++{++	int fd[2];++	pid_t pid;++	int offs = 0;++	int rc = 1;++++	if (pipe(fd) == -1) {++		fprintf(stderr, "Failed to create pipe: %s\n", strerror(errno));++		return 1;++	}++++	pid = fork();++	if (pid == -1) {++		fprintf(stderr, "Unable to fork: %s\n", strerror(errno));++		close(fd[0]);++		close(fd[1]);++		return 1;++	}++	if (pid == 0) {++		close(fd[0]);++		dup2(fd[1], STDOUT_FILENO);++		if (execlp("systemd-ask-password", "systemd-ask-password", prompt, NULL) == -1) {

Please pass the whole path to systemd-ask-password in the second argument to execlp(). (If this patch was obtained upstream, please send a patch to them doing the same thing.)

hbeberman

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentmicrosoft/CBL-Mariner

Nopatch lua CVE-2020-15889

I looked at Lua 5.3.5, and the offending code doesn't seem to be there. Looking closer.

dmcilvaney

comment created time in a month

pull request commentmicrosoft/CBL-Mariner

Nopatch lua CVE-2020-15889

From my reading of https://nvd.nist.gov/vuln/detail/CVE-2020-15889, this affects all versions of Lua up to (and including) 5.4.0:

Lua through 5.4.0 has a getobjname heap-based buffer over-read because youngcollection in lgc.c uses markold for an insufficient number of list members.

So it might be prudent to use the upstream patch: https://github.com/lua/lua/commit/127e7a6c8942b362aa3c6627f44d660a4fb75312

dmcilvaney

comment created time in a month

pull request commentmicrosoft/CBL-Mariner

Nopatch groff CVE-2000-0803

Very few people will use groff by itself these days, so the impact in Mariner, even if this is unpatched, is minimal. (Groff is used by man pages, but that's fine as far as this vulnerability is concerned, because those are provided by the system.)

dmcilvaney

comment created time in a month

Pull request review commentmicrosoft/CBL-Mariner

installutils: Supply blank /etc/machine-id file

 func calculateTotalPackages(packages []string, installRoot string) (totalPackage 	return } +// addMachineID creates the /etc/machine-id file in the installChroot func addMachineID(installChroot *safechroot.Chroot) (err error) {+	// From https://www.freedesktop.org/software/systemd/man/machine-id.html:+	// For operating system images which are created once and used on multiple+	// machines, for example for containers or in the cloud, /etc/machine-id+	// should be an empty file in the generic file system image. An ID will be+	// generated during boot and saved to this file if possible.+ 	const (-		squashErrors = false-		setupProgram = "/bin/systemd-machine-id-setup"+		squashErrors       = false+		setupProgram       = "install"+		machineIDFile      = "/etc/machine-id"+		machineIDFilePerms = "0644" 	) -	// Check if systemd-machine-id-setup is present before invoking it,-	// some images will not use systemd (such as a container)-	exists, _ := file.PathExists(filepath.Join(installChroot.RootDir(), setupProgram))-	if !exists {-		logger.Log.Debugf("'%s' not found inside chroot '%s', skipping adding machine ID", setupProgram, installChroot.RootDir())-		return-	}- 	ReportAction("Configuring machine id")  	err = installChroot.UnsafeRun(func() error {-		return shell.ExecuteLive(squashErrors, setupProgram)+		setupArgs := []string{"-m", machineIDFilePerms, "/dev/null", machineIDFile}+		return shell.ExecuteLive(squashErrors, setupProgram, setupArgs...)

Do you need to shell out to create an empty file with a given permission? Can you use f, err := os.OpenFile("/etc/machine-id", os.O_CREATE, 0644); f.Close() instead?

christopherco

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentmicrosoft/CBL-Mariner

Nopatch httpd CVE-1999-0236, CVE-1999-1412

1999? Geez.

dmcilvaney

comment created time in a month

startednrc/r4cppp

started time in a month

issue commentlpereira/lwan

Can we use MSYS2 to build or is not supported?

I don't know anything about Windows, so this isn't supported. Lwan was initially Linux-only but I added support for BSD systems as that's still in the same ballpark as far as familiarity goes.

If you need such support, feel free to add it (I would also welcome a buildbot worker instance).

Alternatively, if you want to use Lwan on Windows, even WSL1 is sufficient.

On Mon, Sep 28, 2020, 11:57 Johan Söderlind Åström notifications@github.com wrote:

Both cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release and cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release does not work.

https://github.com/nanomsg/nng works with MSYS2.

MINGW64 /c/Users/Johan/Documents/lwan/build $ cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -- The C compiler identification is GNU 10.1.0 -- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Running CMake for lwan (Scalable, high performance, experimental web server) -- Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version "0.29.2") -- Found ZLIB: C:/msys64/mingw64/lib/libz.dll.a (found version "1.2.11") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Checking for modules 'luajit>=2.0;luajit<=2.0.999' -- No package 'luajit' found -- No package 'luajit' found -- Checking for modules 'lua>=5.1.0;lua<=5.1.999' -- No package 'lua' found -- No package 'lua' found -- Checking for modules 'lua51>=5.1.0;lua51<=5.1.999' -- No package 'lua51' found -- No package 'lua51' found -- Checking for modules 'lua5.1>=5.1.0;lua5.1<=5.1.999' -- No package 'lua5.1' found -- No package 'lua5.1' found -- Checking for modules 'lua-5.1>=5.1.0;lua-5.1<=5.1.999' -- No package 'lua-5.1' found -- No package 'lua-5.1' found -- Disabling Lua support -- Checking for modules 'libbrotlienc;libbrotlidec;libbrotlicommon' -- Found libbrotlienc, version 1.0.7 -- Found libbrotlidec, version 1.0.7 -- Found libbrotlicommon, version 1.0.7 -- Checking for module 'libzstd' -- Found libzstd, version 1.4.4 -- Using built-in context switching routines for AMD64 processors -- Looking for linux/capability.h -- Looking for linux/capability.h - not found -- Looking for sys/auxv.h -- Looking for sys/auxv.h - not found -- Looking for sys/epoll.h -- Looking for sys/epoll.h - not found -- Looking for 3 include files sys/time.h, ..., sys/event.h -- Looking for 3 include files sys/time.h, ..., sys/event.h - not found -- Looking for alloca.h -- Looking for alloca.h - not found -- Looking for get_current_dir_name -- Looking for get_current_dir_name - not found -- Looking for reallocarray -- Looking for reallocarray - not found -- Looking for mempcpy -- Looking for mempcpy - found -- Looking for memrchr -- Looking for memrchr - not found -- Looking for pipe2 -- Looking for pipe2 - not found -- Looking for accept4 -- Looking for accept4 - not found -- Looking for readahead -- Looking for readahead - not found -- Looking for mkostemp -- Looking for mkostemp - not found -- Looking for clock_gettime -- Looking for clock_gettime - found -- Looking for pthread_barrier_init -- Looking for pthread_barrier_init - found -- Looking for pthread_set_name_np -- Looking for pthread_set_name_np - not found -- Looking for eventfd -- Looking for eventfd - not found -- Looking for posix_fadvise -- Looking for posix_fadvise - not found -- Looking for getentropy -- Looking for getentropy - not found -- Looking for fwrite_unlocked -- Looking for fwrite_unlocked - not found -- Looking for gettid -- Looking for gettid - not found -- Looking for secure_getenv -- Looking for secure_getenv - not found -- Looking for dladdr -- Looking for dladdr - not found -- Performing Test HAVE_STD_GNU99 -- Performing Test HAVE_STD_GNU99 - Success -- Performing Test HAVE_BUILTIN_CPU_INIT -- Performing Test HAVE_BUILTIN_CPU_INIT - Success -- Performing Test HAVE_BUILTIN_CLZLL -- Performing Test HAVE_BUILTIN_CLZLL - Success -- Performing Test HAVE_BUILTIN_FPCLASSIFY -- Performing Test HAVE_BUILTIN_FPCLASSIFY - Success -- Performing Test HAVE_BUILTIN_MUL_OVERFLOW -- Performing Test HAVE_BUILTIN_MUL_OVERFLOW - Success -- Performing Test HAVE_BUILTIN_ADD_OVERFLOW -- Performing Test HAVE_BUILTIN_ADD_OVERFLOW - Success -- Performing Test HAVE_STATIC_ASSERT -- Performing Test HAVE_STATIC_ASSERT - Success -- Valgrind headers not found -- disabling valgrind support -- Performing Test HAVE_MTUNE_NATIVE -- Performing Test HAVE_MTUNE_NATIVE - Success -- Performing Test HAVE_MARCH_NATIVE -- Performing Test HAVE_MARCH_NATIVE - Success -- Performing Test HAVE_STACK_PROTECTOR_EXPLICIT -- Performing Test HAVE_STACK_PROTECTOR_EXPLICIT - Success -- Performing Test HAVE_IMMEDIATE_BINDING -- Performing Test HAVE_IMMEDIATE_BINDING - Success -- Performing Test HAVE_READ_ONLY_GOT -- Performing Test HAVE_READ_ONLY_GOT - Success -- Performing Test HAVE_NO_PLT -- Performing Test HAVE_NO_PLT - Success -- Performing Test HAVE_NOEXEC_STACK -- Performing Test HAVE_NOEXEC_STACK - Success -- Performing Test HAVE_ALIGN_FNS -- Performing Test HAVE_ALIGN_FNS - Success -- Performing Test HAVE_NO_SEMANTIC_INTERPOSITION -- Performing Test HAVE_NO_SEMANTIC_INTERPOSITION - Success -- Performing Test HAVE_ALIGN_DATA -- Performing Test HAVE_ALIGN_DATA - Success -- Performing Test HAVE_NO_ASYNC_UNWIND_TABLES -- Performing Test HAVE_NO_ASYNC_UNWIND_TABLES - Success -- Performing Test HAVE_LTO_JOBSERVER -- Performing Test HAVE_LTO_JOBSERVER - Success -- Performing Test HAVE_LTO_FAT_OBJS -- Performing Test HAVE_LTO_FAT_OBJS - Success -- Performing Test HAVE_BUILTIN_IA32_CRC32 -- Performing Test HAVE_BUILTIN_IA32_CRC32 - Success -- Performing Test supports -Wduplicated-cond -- Performing Test supports -Wduplicated-cond - Success -- Performing Test supports -Wduplicated-branches -- Performing Test supports -Wduplicated-branches - Success -- Performing Test supports -Wlogical-op -- Performing Test supports -Wlogical-op - Success -- Performing Test supports -Wrestrict -- Performing Test supports -Wrestrict - Success -- Performing Test supports -Wdouble-promotion -- Performing Test supports -Wdouble-promotion - Success -- Performing Test supports -Wno-unused-parameter -- Performing Test supports -Wno-unused-parameter - Success -- Performing Test supports -Wstringop-truncation -- Performing Test supports -Wstringop-truncation - Success -- Performing Test supports -Wvla -- Performing Test supports -Wvla - Success -- Performing Test supports -Wunsequenced -- Performing Test supports -Wunsequenced - Failed -- Performing Test supports -Wno-free-nonheap-object -- Performing Test supports -Wno-free-nonheap-object - Success -- Found PythonInterp: C:/msys64/mingw64/bin/python3.exe (found suitable version "3.8.2", minimum required is "3") -- Using Brotli for mimegen -- Checking for module 'sqlite3>=3.6.20' -- Found sqlite3, version 3.31.1 -- Not building benchmark suite: database libraries not found. -- Configuring done -- Generating done -- Build files have been written to: C:/Users/Johan/Documents/lwan/build

MINGW64 /c/Users/Johan/Documents/lwan/build $ mingw32-make.exe Scanning dependencies of target bin2hex [ 1%] Building C object src/bin/tools/CMakeFiles/bin2hex.dir/bin2hex.c.obj In file included from C:\Users\Johan\Documents\lwan\src\bin\tools\bin2hex.c:24: C:/Users/Johan/Documents/lwan/src/lib/missing/sys/mman.h:21:15: fatal error: sys/mman.h: No such file or directory 21 | #include_next <sys/mman.h> | ^~~~~~~~~~~~ compilation terminated. mingw32-make[2]: *** [src\bin\tools\CMakeFiles\bin2hex.dir\build.make:83: src/bin/tools/CMakeFiles/bin2hex.dir/bin2hex.c.obj] Error 1 mingw32-make[1]: *** [CMakeFiles\Makefile2:521: src/bin/tools/CMakeFiles/bin2hex.dir/all] Error 2 mingw32-make: *** [Makefile:149: all] Error 2

MINGW64 /c/Users/Johan/Documents/lwan/build

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGIPSG7YLJC52MVC46TSIDMAJANCNFSM4R43SCMA .

KenthJohan

comment created time in a month

Pull request review commentLIS/LISAv2

Implement Feature, Notifier and other improvements

 def mkdir(         exist_ok: bool = False,     ) -> None:         path_str = self._purepath_to_str(path)+        self.initialize()         assert self._inner_shell         self._inner_shell.mkdir(path_str, mode=mode, parents=parents, exist_ok=exist_ok)      def exists(self, path: PurePath) -> bool:+        self.initialize()         assert self._inner_shell         path_str = self._purepath_to_str(path)         return cast(bool, self._inner_shell.exists(path_str))      def remove(self, path: PurePath, recursive: bool = False) -> None:+        self.initialize()         assert self._inner_shell         path_str = self._purepath_to_str(path)         self._inner_shell.remove(path_str, recursive)      def chmod(self, path: PurePath, mode: int) -> None:+        self.initialize()         assert self._inner_shell         path_str = self._purepath_to_str(path)         self._inner_shell.chmod(path_str, mode)      def stat(self, path: PurePath) -> os.stat_result:+        self.initialize()         assert self._inner_shell         path_str = self._purepath_to_str(path)         sftp_attributes: paramiko.SFTPAttributes = self._inner_shell.stat(path_str)

Sure, sounds good

squirrelsc

comment created time in a month

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Implement Feature, Notifier and other improvements

         "adminUserName": "[parameters('adminUserName')]",         "adminPassword": "[parameters('adminPassword')]",         "adminKeyData": "[parameters('adminKeyData')]",+        "availabilitySetTags": "[parameters('availabilitySetTags')]",

Can the code from that vscode extension be called outside vscode and added to the CI? Not everybody uses IDEs, or will have that extension set up properly. (This is of course unrelated to this PR. Just thinking out loud here.)

squirrelsc

comment created time in a month

Pull request review commentLIS/LISAv2

Implement Feature, Notifier and other improvements

 def spawn(         use_pty: bool = False,         allow_error: bool = True,     ) -> Any:+        self.initialize()

I see. I usually don't like these kinds of proxy classes, because it's very easy to make a mistake that takes hours to fix. (For instance, I've spent hours debugging issues because of a silly mistake involving copy/paste and forgetting to rename a variable.)

If there was a way to query what the _inner_shell offers as commands (e.g. by prefixing all command methods with a cmd_ prefix, which works well even for cases where a command name is the same as a reserved Python keyword) and create these methods here automatically during __new__ or __init__ time, calls to initialize() (which could be renamed to ensure_connected()), the PurePath conversion, and the method call forwarding could all be automated.

I don't know, however, how it would play with auto-completing in IDEs. (I don't use IDEs.)

squirrelsc

comment created time in a month

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

Implement Feature, Notifier and other improvements

 from .ntttcp import Ntttcp from .uname import Uname -__all__ = ["Echo", "Gcc", "Git", "Lscpu", "Make", "Ntttcp", "Uname"]+__all__ = ["Cat", "Echo", "Gcc", "Git", "Lscpu", "Make", "Ntttcp", "Uname"]

Agreed. I never said anything about Echo because it's a useful example on how to write a new tool, but if we can use Python APIs, we should just use them.

squirrelsc

comment created time in a month

PullRequestReviewEvent

pull request commentLIS/LISAv2

vmbus interrupt check test is no longer valid in big size Azure VM

(BTW, in the future, please try writing better commit messages in the first line; "update some-file.ext" isn't a good message, because Git tracks which files are being changed already. The second line could be a better first line in 81d60df for instance.)

juhlee-microsoft

comment created time in a month

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

vmbus interrupt check test is no longer valid in big size Azure VM

 function verify_vmbus_interrupts() {     #     # Verify if VMBUS interrupts are processed by all CPUs     #-    while read line+    while read -r line     do         if [[ ($line = *hyperv* ) || ( $line = *Hypervisor* ) ]]; then-            for (( core=0; core<=$cpu_count-1; core++ ))+            for (( core=0; core<=${cpu_count-1}; core++ ))

(Otherwise, the loop won't run.)

juhlee-microsoft

comment created time in a month

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

vmbus interrupt check test is no longer valid in big size Azure VM

 function verify_vmbus_interrupts() {     #     # Verify if VMBUS interrupts are processed by all CPUs     #-    while read line+    while read -r line     do         if [[ ($line = *hyperv* ) || ( $line = *Hypervisor* ) ]]; then-            for (( core=0; core<=$cpu_count-1; core++ ))+            for (( core=0; core<=${cpu_count-1}; core++ ))

Or, alternatively:

            for core in $(seq $((cpu_count - 1)))

So that $((cpu_count - 1)) is evaluated only once. (Not really necessary, as this is just a shell script and whatnot.)

juhlee-microsoft

comment created time in a month

PullRequestReviewEvent

Pull request review commentLIS/LISAv2

vmbus interrupt check test is no longer valid in big size Azure VM

 function verify_vmbus_interrupts() {     #     # Verify if VMBUS interrupts are processed by all CPUs     #-    while read line+    while read -r line     do         if [[ ($line = *hyperv* ) || ( $line = *Hypervisor* ) ]]; then-            for (( core=0; core<=$cpu_count-1; core++ ))+            for (( core=0; core<=${cpu_count-1}; core++ ))
            for (( core=0; core<=$((cpu_count-1)); core++ ))
juhlee-microsoft

comment created time in a month

PullRequestReviewEvent

push eventlpereira/lwan

Leandro Pereira

commit sha eee6de8a059ade13e2ec78c09723cf1a5a14fb53

Remove AutoFDO profiles These get stale, and without proper tooling to update them regularly, they might hurt more than help.

view details

push time in a month

push eventlpereira/lwan

Leandro Pereira

commit sha c43d8d2707f3e45f1774a86b7eb52d737c95fd3f

If getting number of available CPUs fail, use #online_cpus

view details

Leandro Pereira

commit sha ddb8ff40fe3763d12244ffc0b2428bc7fa43dd7c

Avoid yielding for every request when servicing pipelined requests Improves throughput by ~30%.

view details

push time in a month

startedblushft/go-diagrams

started time in a month

Pull request review commentLIS/LISAv2

vmbus interrupt check test is no longer valid in big size Azure VM

 function verify_vmbus_interrupts() {     #     # Verify if VMBUS interrupts are processed by all CPUs     #-    while read line+    while read -r line     do         if [[ ($line = *hyperv* ) || ( $line = *Hypervisor* ) ]]; then-            for (( core=0; core<=$cpu_count-1; core++ ))+            for (( core=0; core<=${cpu_count-1}; core++ ))             do-                intrCount=$(echo "$line" | xargs echo |cut -f $(( $core+2 )) -d ' ')+                intrCount=$(echo "$line" | xargs echo | cut -f $(( ${core+2} )) -d ' ')

And is it working? I didn't know that you could do arithmetic inside ${}, only inside $(()). I tried it here and this doesn't seem to be what you're looking for:

bash-3.2$ var=123
bash-3.2$ echo ${var+2}
2
bash-3.2$ echo ${var+300}
300

The original code, however, seems to be correct here:

bash-3.2$ echo $((var+2))
125
bash-3.2$ echo $((var+300))
423
juhlee-microsoft

comment created time in a month

PullRequestReviewEvent
more