Downloads:

38

Downloads of v 2.0:

38

Last Update:

11 Sep 2021

Package Maintainer(s):

Software Author(s):

  • NeoSmart Technologies Mahmoud Al-Qudsi

Tags:

tac cat gnu coreutils concat cli foss utility backwards

tac - Reverse Cat

  • 1
  • 2
  • 3

2.0 | Updated: 11 Sep 2021

Downloads:

38

Downloads of v 2.0:

38

Maintainer(s):

Software Author(s):

  • NeoSmart Technologies Mahmoud Al-Qudsi

  • 1
  • 2
  • 3
tac - Reverse Cat 2.0

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details

Deployment Method: Individual Install, Upgrade, & Uninstall

To install tac - Reverse Cat, run the following command from the command line or from PowerShell:

>

To upgrade tac - Reverse Cat, run the following command from the command line or from PowerShell:

>

To uninstall tac - Reverse Cat, run the following command from the command line or from PowerShell:

>

Deployment Method:

📝 NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade tac -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade tac -y --source="'INTERNAL REPO URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install tac
  win_chocolatey:
    name: tac
    version: '2.0'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'tac' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '2.0'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller tac
{
    Name     = "tac"
    Version  = "2.0"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'tac':
  ensure   => '2.0',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved by moderator TheCakeIsNaOH on 11 Sep 2021.

Description

tac is a high-performance, simd-accelerated, cross-platform rewrite of the GNU tac utility from Coreutils, released under a BSD-compatible (MIT) license. tac reads input from a file (or from stdin, but see below) and then prints it line-by-line backwards.

This tac implementation uses simd-acceleration for new line detection (read more about that here) and utilizes memory-mapped files on all supported operating systems. It is additionally written in rust for maximum integrity and safety.

Who needs a faster tac anyway?

Good question. Try grepping through a multi-gigabyte web access log file in reverse chronological order (tac --line-buffered access.log | grep foo) and then get back to me.

tac reads lines from any combination of stdin and/or zero or more files and writes the lines to the output in reverse order.

Example

$ echo -e "hello\nworld" | tac
world
hello

Implementation Notes

This implementation of tac uses SIMD instruction sets (AVX2, NEON) to accelerate the detection of new lines. The usage of memory-mapped files additionally boosts performance by avoiding slowdowns caused by context switches when reading from the input if speculative execution mitigations are enabled. It is significantly (2.55x if mitigations disabled, more otherwise) faster than the version of tac that ships with GNU Coreutils, in addition to being more liberally licensed.

To obtain maximum performance:

  • Try not to pipe input into tac. e.g. instead of running cat /usr/share/dict/words | tac, run tac /usr/share/dict/words directly. Because tac by definition must reach the end-of-file before it can emit its input with the lines reversed, if you use tac's stdin interface (e.g. cat foo | tac), it must buffer all stdin input before it can begin to process the results. tac will try to buffer in memory, but once it exceeds a certain high-water mark (currently 4 MiB), it switches to disk-based buffering (because it can't know how large the input is or if it will end up exceeding the available free memory).
  • Always try to place tac at the start of a pipeline where possible. Even if you can guarantee that the input to tac will not exceed the in-memory buffering limit (see above), tac is almost certainly faster than any other command in your pipeline, and if you are going to reverse the output, you will benefit most if you reverse it from the start, unless you are always going to run the command to completion. For example, instead of running grep foo /var/log/nginx/access.log | tac, run tac /var/log/nginx/access.log | grep foo. This will (significantly) reduce the amount of time/work before the first n matches are reported (because the file is first quickly reversed then searched in the desired order, vs slowly searched in its entirety and only then are the results reversed).
  • Use line-buffered output mode (tac --line-buffered) if tac is piping into another command rather than writing to the tty directly. This gives you "live" streaming of results and lets you terminate much sooner if you're only looking for the first n matches. e.g. tac --line-buffered access.log | grep foo will print its first match much, much sooner than tac access.log | grep foo would.
  • In the same vein, if you are chaining the output of n utilities, make sure that all commands up to n - 1 are all using line-buffered mode unless you don't care about latency and only care about throughput. For example, to print the first two matches for some grep pattern: tac --line-buffered access.log | grep --line-buffered foo | head -n2.

legal\LICENSE.txt
MIT License

Copyright (c) 2017 NeoSmart Technologies <https://neosmart.net/>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
legal\VERIFICATION.txt
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

Package can be verified like this:

1. Go to https://github.com/neosmart/tac/releases/2.0, and download from there.

   x86_64: https://github.com/neosmart/tac/releases/download/2.0/tac-2.0-windows-x64.zip

   to download the ZIP archive and extract the executable. You may wish to rename one of the files.

2. You can use one of the following methods to obtain the SHA512 checksum:
   - Use powershell function 'Get-FileHash'
   - Use Chocolatey utility 'checksum.exe'

   checksum:   19830a2328dbf85920a4ff757bfae9f5354c886e67d97aa2643840f017fb025e45cf075428aebcf5d1af60604243132acf9665b6530b8fa3af7e4db88a27fe61

File 'LICENSE.txt' obtained from:
   https://github.com/neosmart/tac/blob/2.0/LICENSE
tools\x64\tac.exe
md5: EB1CE23A4937ABA2300B64BAA80D81C0 | sha1: E9DBD94F28530702AF6670551B2FBC42E70C440C | sha256: EF6C2C97ECC2105C3E557E91FB61C91CA01893E1806EAAAAC3C24349E1814CE8 | sha512: 19830A2328DBF85920A4FF757BFAE9F5354C886E67D97AA2643840F017FB025E45CF075428AEBCF5D1AF60604243132ACF9665B6530B8FA3AF7E4DB88A27FE61

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status

tac is now SIMD-accelerated and avails itself of AVX2 instructions

where possible. Detection is dynamic and happens at runtime, no special

compilation flags are required. See README.md for more

information.

The Windows and Linux precompiled binaries attached to this release are statically built. The FreeBSD and macOS assets are dynamically linked. The Windows build is digitally signed with the NeoSmart Technologies Authenticode certificate.


Discussion for the tac - Reverse Cat Package

Ground Rules:

  • This discussion is only about tac - Reverse Cat and the tac - Reverse Cat package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or tac - Reverse Cat, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus