• Guest
HabraHabr
  • Main
  • Users

  • Development
    • Programming
    • Information Security
    • Website development
    • JavaScript
    • Game development
    • Open source
    • Developed for Android
    • Machine learning
    • Abnormal programming
    • Java
    • Python
    • Development of mobile applications
    • Analysis and design of systems
    • .NET
    • Mathematics
    • Algorithms
    • C#
    • System Programming
    • C++
    • C
    • Go
    • PHP
    • Reverse engineering
    • Assembler
    • Development under Linux
    • Big Data
    • Rust
    • Cryptography
    • Entertaining problems
    • Testing of IT systems
    • Testing Web Services
    • HTML
    • Programming microcontrollers
    • API
    • High performance
    • Developed for iOS
    • CSS
    • Industrial Programming
    • Development under Windows
    • Image processing
    • Compilers
    • FPGA
    • Professional literature
    • OpenStreetMap
    • Google Chrome
    • Data Mining
    • PostgreSQL
    • Development of robotics
    • Visualization of data
    • Angular
    • ReactJS
    • Search technologies
    • Debugging
    • Test mobile applications
    • Browsers
    • Designing and refactoring
    • IT Standards
    • Solidity
    • Node.JS
    • Git
    • LaTeX
    • SQL
    • Haskell
    • Unreal Engine
    • Unity3D
    • Development for the Internet of things
    • Functional Programming
    • Amazon Web Services
    • Google Cloud Platform
    • Development under AR and VR
    • Assembly systems
    • Version control systems
    • Kotlin
    • R
    • CAD/CAM
    • Customer Optimization
    • Development of communication systems
    • Microsoft Azure
    • Perfect code
    • Atlassian
    • Visual Studio
    • NoSQL
    • Yii
    • Mono и Moonlight
    • Parallel Programming
    • Asterisk
    • Yandex API
    • WordPress
    • Sports programming
    • Lua
    • Microsoft SQL Server
    • Payment systems
    • TypeScript
    • Scala
    • Google API
    • Development of data transmission systems
    • XML
    • Regular expressions
    • Development under Tizen
    • Swift
    • MySQL
    • Geoinformation services
    • Global Positioning Systems
    • Qt
    • Dart
    • Django
    • Development for Office 365
    • Erlang/OTP
    • GPGPU
    • Eclipse
    • Maps API
    • Testing games
    • Browser Extensions
    • 1C-Bitrix
    • Development under e-commerce
    • Xamarin
    • Xcode
    • Development under Windows Phone
    • Semantics
    • CMS
    • VueJS
    • GitHub
    • Open data
    • Sphinx
    • Ruby on Rails
    • Ruby
    • Symfony
    • Drupal
    • Messaging Systems
    • CTF
    • SaaS / S+S
    • SharePoint
    • jQuery
    • Puppet
    • Firefox
    • Elm
    • MODX
    • Billing systems
    • Graphical shells
    • Kodobred
    • MongoDB
    • SCADA
    • Hadoop
    • Gradle
    • Clojure
    • F#
    • CoffeeScript
    • Matlab
    • Phalcon
    • Development under Sailfish OS
    • Magento
    • Elixir/Phoenix
    • Microsoft Edge
    • Layout of letters
    • Development for OS X
    • Forth
    • Smalltalk
    • Julia
    • Laravel
    • WebGL
    • Meteor.JS
    • Firebird/Interbase
    • SQLite
    • D
    • Mesh-networks
    • I2P
    • Derby.js
    • Emacs
    • Development under Bada
    • Mercurial
    • UML Design
    • Objective C
    • Fortran
    • Cocoa
    • Cobol
    • Apache Flex
    • Action Script
    • Joomla
    • IIS
    • Twitter API
    • Vkontakte API
    • Facebook API
    • Microsoft Access
    • PDF
    • Prolog
    • GTK+
    • LabVIEW
    • Brainfuck
    • Cubrid
    • Canvas
    • Doctrine ORM
    • Google App Engine
    • Twisted
    • XSLT
    • TDD
    • Small Basic
    • Kohana
    • Development for Java ME
    • LiveStreet
    • MooTools
    • Adobe Flash
    • GreaseMonkey
    • INFOLUST
    • Groovy & Grails
    • Lisp
    • Delphi
    • Zend Framework
    • ExtJS / Sencha Library
    • Internet Explorer
    • CodeIgniter
    • Silverlight
    • Google Web Toolkit
    • CakePHP
    • Safari
    • Opera
    • Microformats
    • Ajax
    • VIM
  • Administration
    • System administration
    • IT Infrastructure
    • *nix
    • Network technologies
    • DevOps
    • Server Administration
    • Cloud computing
    • Configuring Linux
    • Wireless technologies
    • Virtualization
    • Hosting
    • Data storage
    • Decentralized networks
    • Database Administration
    • Data Warehousing
    • Communication standards
    • PowerShell
    • Backup
    • Cisco
    • Nginx
    • Antivirus protection
    • DNS
    • Server Optimization
    • Data recovery
    • Apache
    • Spam and antispam
    • Data Compression
    • SAN
    • IPv6
    • Fidonet
    • IPTV
    • Shells
    • Administering domain names
  • Design
    • Interfaces
    • Web design
    • Working with sound
    • Usability
    • Graphic design
    • Design Games
    • Mobile App Design
    • Working with 3D-graphics
    • Typography
    • Working with video
    • Work with vector graphics
    • Accessibility
    • Prototyping
    • CGI (graphics)
    • Computer Animation
    • Working with icons
  • Control
    • Careers in the IT industry
    • Project management
    • Development Management
    • Personnel Management
    • Product Management
    • Start-up development
    • Managing the community
    • Service Desk
    • GTD
    • IT Terminology
    • Agile
    • Business Models
    • Legislation and IT-business
    • Sales management
    • CRM-systems
    • Product localization
    • ECM / EDS
    • Freelance
    • Venture investments
    • ERP-systems
    • Help Desk Software
    • Media management
    • Patenting
    • E-commerce management
    • Creative Commons
  • Marketing
    • Conferences
    • Promotion of games
    • Internet Marketing
    • Search Engine Optimization
    • Web Analytics
    • Monetize Web services
    • Content marketing
    • Monetization of IT systems
    • Monetize mobile apps
    • Mobile App Analytics
    • Growth Hacking
    • Branding
    • Monetize Games
    • Display ads
    • Contextual advertising
    • Increase Conversion Rate
  • Sundry
    • Reading room
    • Educational process in IT
    • Research and forecasts in IT
    • Finance in IT
    • Hakatonas
    • IT emigration
    • Education abroad
    • Lumber room
    • I'm on my way

How to patch find under FreeBSD?

 
3r3-31.

We teach FreeBSD to look for files by extended attributes

3r3394.  
Summary: The FreeBSD OS has a file system-level control mechanism for extended file attributes (extattr). Using the standard commands setextattr, getextattr and rmextattr you can create, read and delete comments, keywords and other file metadata. But you cannot search for files by extended attributes. In addition, extended attributes are lost when copying a file. In two articles, I will offer my patches for the find and cp commands that eliminate these shortcomings. However, I am not a professional programmer and did patches for my tasks, therefore, the proposed solution should be considered solely as a proof of concept and modifying with a file. 3r3394.  
3r3391. 3r3394.  
Inherited from ancient times, we got the monstrous and awkward hierarchical 3r3321. file systems But along with the rapid increase in the amount of information, their main drawback is manifested more and more clearly - the limited possibilities of classification. There are actually two such possibilities: to assign meaningful file names and sort these files into directories with meaningful names. It worked well when the most common photographic film contained only 36 frames. They were spent slowly, sometimes for several months, carefully choosing the objects to be photographed. Then 36 photos could be scanned and placed in the folders “Dacha”, “Vacation” and “Cats”. But now, when you can take hundreds of pictures on your smartphone’s camera in a day, and you can download a couple of hundred PDF instructions in an hour from the Internet, this approach becomes too time consuming. The increased volume of information can no longer be classified hierarchically - the human brain will simply become entangled in such a hierarchy. Therefore, the “New Folder (2)”, “All Pictures” and “Disassemble” directories appear over time on the computer. 3r3394.  
3r3394.  
In response to the limitations that have arisen, the concept of 3r320 has emerged. semantic
file system. In such a file, some metadata is assigned to files, which are then used for classification and search. The directory hierarchy is no longer relevant here, just like the file name. A striking example is cloud object storage, in which all objects are located in a flat address space and are equipped with metadata describing them. Here they are only intended to work at the API level, and not at the user level. Object stores have not reached desktop systems yet. 3r3394.  
3r3394.  
And I wanted to assign keywords to all my files and store them on the same level on my local machine right now. I have many interests, but since I don’t remember everything, I constantly have to write down notes, recipes, techniques, instructions and photos. To shove it all into folders - there is no longer any strength or time. 3r3394.  
3r3394.  
Fortunately, desktop FS are catching up with the trend. In many of them, it has long been possible to set keywords for some file types (in Windows, as far as I know, for Word documents and images). However, in most cases, this metadata is stored in the file itself, and not at the file system level (hence the limitation on file type - not everyone supports EXIF ​​and IPTC). But my favorite FreeBSD provides a mechanism for managing the extended attributes of a file of any type at the file system level. As I understand it, somewhere in the depths of the FS, a meta-file is created that is tightly associated with the main file, and all the metadata is written to it. To work with extended attributes in FreeBSD, there is the setextattr, getextattr, and rmextattr family of commands. 3r3394.  
3r3394.  
A simple example:
 
3r3394.  
3r380. $ setextattr user comment cats cat.jpg
$ getextattr user comment cat.jpg
cat.jpg cats
3r3394.  
In principle, this is something you can do. If it were not for one “but”: there is no mechanism for searching files by extended attributes in the fryashechka. What is the use of tagging files if I still can’t find them by tags? 3r3394.  
3r3394.  
But if the mountain does not go to Mohammed In general, I decided to teach myself fryashechku search my documents by keywords. But I’m a chemical analyst, not a programmer, and I studied coding myself on Google. Therefore, first of all, I turned to Google. Suddenly everything was thought up long before me, and I don’t have to painfully remember the peculiarities of working with pointers in C? It turned out - yes, it was invented. I found 3r350. one patch
for the find command. That's just bad luck - the patch taught the find command to check whether a specific attribute is set on the file. And that's all. And look for the contents of this attribute - dismiss. 3r3394.  
3r3394.  
It was necessary, after all, to suffer with pointers and memory in C. A couple of sleepless nights, three liters of green tea and a black belt for googling - and I made 3r356. such a patch (for FreeBSD ???-RELEASE)
. 3r3394.  
3r3394.  
You can apply it as follows (the source code must be installed on FreeBSD):
 
3r3394.  
3r380. cd /usr/src/usr.bin/find
patch < /patch-find.diff
make
make install clean
3r3394.  
And use this:
 
3r3394.  
3r380. find. -userattr comment = cats
./cat.jpg
3r3394.  
This command will find all files whose comment attribute contains the substring cats. 3r3394.  
3r3394.  
Of course, it’s too early to talk about some working solution here - in my code there are practically no checks on the input parameter, and the buffer sizes are taken from the bald (I read somewhere that the limit on the size of the extended attribute is 1024 bytes, but then I could not find this information). I invite everyone to participate in bringing the project to readiness and 3r390. I post the full code for the find utility
, honestly copied from the official FreeBSD repository, with my changes. 3r3394.  
3r3394.  
So, now I could somehow find the files by keywords. But a new attack arose: when copying a file, all associated extended attributes were lost The problem was in the cp command, but about that next time. 3r3102.
3r399. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r3-300.
3r3102.

It may be interesting

  • Comments
  • About article
  • Similar news
This publication has no comments.

weber

Author

11-10-2018, 08:24

Publication Date

Administration / *nix

Category
  • Comments: 0
  • Views: 354
Camunda BPM Meetup Raiffeisenbank
Roskomnadzor is going to collect a fine
For those who choose a firewall
Simple and efficient calculation of
Mikrotik - collection and analysis of
Thymeleaf Tutorial: Chapter 10.
Write a comment
Name:*
E-Mail:


Comments
The Daily Reports is the reliable and authentic news and blog publisher. Visit The Daily Reports for up-to-date US news, international news and policy analysis. Check out: International Politics News
Today, 17:28

saifwordpress

nice post, keep up with this interesting work. It really is good to know that this topic is being covered also on this web site so cheers for taking time to discuss this!  https://l23movies.club/
Today, 15:35

Legend SEO

Extremely helpful post. This is my first time i visit here. I discovered such a large number of intriguing stuff in your blog particularly its exchange. Truly its extraordinary article. Keep it up.먹튀검증사이트

Today, 14:34

raymond weber

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me.  pigmentvlekken verwijderen - dermasensation.nl
Today, 14:25

jacksonseo

Bangalore Escorts provides escort call girls by the escort agency in Bangalore. We have selected the best high profile call girls in Bangalore. Visit us www.piyagupta.com/
South Bangalore  Escorts || Marathahalli Escorts || Electronic City Escorts || Hebbal Escorts || Mg road Escorts || Ulsoor Escorts || Ub city Escorts || Nandi hills Escorts || Malleswaram Escorts || Commercial street  Escorts || Indira nagar Escorts || Hsr layout Escorts

Today, 12:24

piyagupta01

Adv
Website for web developers. New scripts, best ideas, programming tips. How to write a script for you here, we have a lot of information about various programming languages. You are a webmaster or a beginner programmer, it does not matter, useful articles will help to make your favorite business faster.

Login

Registration Forgot password